homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

Crossbrowser 0 margins?

 7:27 am on Mar 25, 2001 (gmt 0)

Is there a way to zer0 out the margins in both NN and IE? Can it be done via css?



 7:38 am on Mar 25, 2001 (gmt 0)

BH, check out this thread:

There are some good references there -- and unfortunately the short answer is basically "no". Actually, the answer is "sometimes", but NN is so quirky, that it's not clear when you can and when you can't, and each version of NN has its own quirks.

I've been playing with this off and on for a week, and still don't feel like I've got a good handle. The future looks brighter, since NN6 and Mozilla now seem fine, and MSIE has been good on this one for a while. But for the moment, things be weird.


 10:19 am on Mar 26, 2001 (gmt 0)

This is the code for ridding both IE and NN or where you looking for something more complex?

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">


 10:34 am on Mar 26, 2001 (gmt 0)

Thanks for that, knighty.

If all you need is body margins to be zero, that's the solution for IE, and it's an almost in NN4.x, leaving a one pixel sliver. Here's another thread [webmasterworld.com] that digs into the issue a bit more.

I've been on a different quest, and that may have blinded me to BH's actual question. What I've been looking for is a way to get rid of the bottom-margin in various box structures (such as any old div, or especially the default structure around an H tag) that will work cross browser.


 10:51 am on Mar 26, 2001 (gmt 0)

...and the magician waved his magic wand and all browsers across all platforms behaved exactly the same and Web Designers lived happily ever after ;)


 11:05 am on Mar 26, 2001 (gmt 0)

LOL! Yes, that's my fantasy.

But this one little item would be so nice. You see, I think that having a top margin and a bottom margin around H tags is confusing to the eye. I'd much rather have only a top margin and bump each paragraph up against the bottom of its heading.

In a css stylesheet, you can state h2{margin-bottom:0em} and Explorer does exactly that: collapses the extra margin. This is W3C recommended browser behavior. But right through all the version 4's, Netscape just ignores it.

Of course, I can get the same look with bold tags, but you know how helpful H tags are with the search engines. I'll give up my aesthetic preferences before I'll sacrifice ranking.


 3:09 pm on Mar 26, 2001 (gmt 0)


>>>>marginwidth="0" marginheight="0">
Thats what I was looking for.

FYI topmargin and leftmargin seem to have been dropped from the latest html standard in the w3c validator. Oh well.

If it works...dont fix it.


 3:41 pm on Mar 26, 2001 (gmt 0)

This works without using the top and left margin tags:

Css sheet:
margin-top : 0px;
margin-left : 0px;
margin-right : 0px;
margin-bottom : 0px;

Body tag:

<body marginwidth="0" marginheight="0">


 3:53 pm on Mar 26, 2001 (gmt 0)

BH you are on the money with the CSS. Topmargin and the other is the body tag are ie extensions.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved