zzxjoanw
zzxjoanw

Reputation: 384

Overriding Firefox 11's baked-in css

I'm trying to remove the 8px margin from the body tag.

I've tried (not all at once)

 * { padding:0; margin:0; }

and

 html, body { padding:0; margin:0 !important; }

and

 body { margin:-8px; }

and even

 <body style="margin:0">

The last one works, but only if I add the style attrib using Firebug; if it's in the original HTML, it gets ignored.

I'm at my wit's end.

Edit: facepalm I figured it out; I'd changed it to a cfm so I could easily call browser-specific styles. Thank you all for your help.

Upvotes: 0

Views: 239

Answers (4)

Curtis
Curtis

Reputation: 103388

Include your stylesheet correctly

As your style is not appearing in FireBug's CSS rule stack, your CSS is probably not linked correctly. Ensure the stylesheet is in your head tag like so:

<head>
    <link href="Style.css" rel="stylesheet" type="text/css" />
</head>

Upvotes: 0

Enrique Moreno Tent
Enrique Moreno Tent

Reputation: 25307

body{ margin: 0;}

works ok for me :P

Upvotes: 0

Guffa
Guffa

Reputation: 700680

All you need is:

body { margin: 0; padding: 0; }

The padding is not needed for Firefox, but for Opera, which uses padding instead of margin for the default.

Demo: http://jsfiddle.net/k3j8Y/

Upvotes: 0

Andres I Perez
Andres I Perez

Reputation: 75409

Include a reset stylesheet instead, this way you will reset all of the default values equally in all browsers.

http://meyerweb.com/eric/tools/css/reset/

Upvotes: 2

Related Questions