Welcome to WebmasterWorld Guest from

Forum Moderators: not2easy

Message Too Old, No Replies

Default padding and margin values?



3:15 pm on Apr 17, 2003 (gmt 0)

10+ Year Member

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?


4:07 pm on Apr 17, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

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!


4:26 pm on Apr 17, 2003 (gmt 0)

10+ Year Member

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?


6:24 pm on Apr 17, 2003 (gmt 0)

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

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.


7:21 pm on Apr 17, 2003 (gmt 0)

10+ Year Member

Thanks Doc! Worked like a charm.


9:54 am on Apr 18, 2003 (gmt 0)

10+ Year Member

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.


4:33 am on Apr 19, 2003 (gmt 0)

10+ Year Member

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.

Featured Threads

Hot Threads This Week

Hot Threads This Month