homepage Welcome to WebmasterWorld Guest from 54.211.157.103
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?
villdelt




msg:1177934
 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?

 

rainborick




msg:1177935
 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!

villdelt




msg:1177936
 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?

DrDoc




msg:1177937
 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.

villdelt




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

Thanks Doc! Worked like a charm.

dmjw01




msg:1177939
 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.

ricfink




msg:1177940
 4:33 am on Apr 19, 2003 (gmt 0)
There is an excellent article dealing with CSS and lists at:
http://www.alistapart.com/stories/taminglists/

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