Browsers and Margin size

They have: 218 posts

Joined: Apr 2001

Hi there,

I'm dynamically setting margins in the body tag, and Mozilla has bigger margins than the equivalent IE margins. I can detect if the browser is not IE and reduce the margins, but what about Opera and Safari (and others)...without testing, are their margin ratios closer to IE or Mozilla?

Thanks

TM

ed_graphicd's picture

They have: 5 posts

Joined: Feb 2004

You could just use CSS to make it fixed, like so:

body { margin: 10px; } // top right bottom left is 10px

or

body { margin: 10px 0 5px 10px; } top is 10px, right is 0, bottom is 5px and left is 10px

body { margin: 10px 0 } // top bottom is 10px, left right is 0;

steady as she goes

They have: 218 posts

Joined: Apr 2001

I could, but I need the embedded Flash file to be centered on the screen dynamically. Somthing like this seems to work (PHP):

function swfMargin ($sw,$sh,$w,$h,$offSet)
{
global $lMarg, $tMarg;
$lMarg = ($sw-$w)/2;
$tMarg = (($sh - $h)/2)+$offSet;
if ($tMarg < 0)
   {
   $tMarg = 0;
   }

}
'

TM

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.