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 / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Default padding and margin values?

10+ Year Member

Msg#: 893 posted 3:15 pm on Apr 17, 2003 (gmt 0)

I am a newbie developer and my unordered lists are being rendered differently in IE6 and NN7. IE6 seems to be adding space onto my ul's and NN7 doesn't. Is there a default value for margin and padding on a ul tag? I would like to be able to control that using CSS and the Tantek hack but I need to know the default values before I change anything. Is this specified anywhere?



WebmasterWorld Senior Member 10+ Year Member

Msg#: 893 posted 4:07 pm on Apr 17, 2003 (gmt 0)

One thing you have to watch for when dealing with IE6 and cross-browser compatibility when it comes to element dimensions is that older versions of IE calculated dimensions in a non-standard way. There's a KnowledgeBase document on this issue and I'll try to look up the URL for it later, but the good news is that you can handle the issue pretty painlessly by using a <!DOCTYPE> that includes both the standards label and a URL. If IE6 sees a <!DOCTYPE> with a URL, it calculates the dimensions in the standards-compliant method (as does NS6/7). If the <!DOCTYPE> has no URL or is missing, it reverts to the method supported by prior versions. You can get help with selecting <!DOCTYPE>s at [w3c.org....] Good luck!


10+ Year Member

Msg#: 893 posted 4:26 pm on Apr 17, 2003 (gmt 0)

I have a doctype specified, I am using xhtml 1.0 transitional.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I think it has to do with the incorrect rendering of the box model by IE. Could this by true?


WebmasterWorld Senior Member drdoc us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 893 posted 6:24 pm on Apr 17, 2003 (gmt 0)

Welcome [webmasterworld.com] to Webmaster World! :)

If uniform margins are important, you can always set them explicitly in your style sheet. Thereby you don't have to rely on the browsers rendering them the exact same way by default.

ul {
margin: 0px 5px;
padding: 0px;

You might have to play around with the exact values, but I'm sure you'll find a setting that works well in the different browsers.


10+ Year Member

Msg#: 893 posted 7:21 pm on Apr 17, 2003 (gmt 0)

Thanks Doc! Worked like a charm.


10+ Year Member

Msg#: 893 posted 9:54 am on Apr 18, 2003 (gmt 0)

I discovered this same issue. If you don't specify any changes to padding and margins on lists, then all the major browsers render everything looking pretty identical. However, IE and Opera achieve the default layout using a default "margin" with zero "padding", whereas Mozilla (and I assume NN) uses a default "padding" with zero "margin". So if you want to change anything the only safe way is to specify both padding AND margin.


10+ Year Member

Msg#: 893 posted 4:33 am on Apr 19, 2003 (gmt 0)
There is an excellent article dealing with CSS and lists at:

That article, plus a little testing on your own, should clear up whatever problems you're experiencing.

Yes, the major browser's DO handle list tags differently. But you can compensate for the differences in the stylesheet.
Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
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