On Thu, April 17, 2008 3:51 pm, kevin mcmonagle wrote:
> hi,
> My friend wants to learn about css so i told him to do the selectutorial
> on the maxdesign site.
> It says to reset the margins in the body then use ems for padding.
> I was reading somewhere that cancelling out the margins in the body
> tells the browsers to go through all the tags and cancel out the margins
> and that it actually adds to download time. I dont know if thats
> realistic or not but ive been using margins for spacing between divs for
> a long time.
>
Assuming you're talking about
body {
margin: 0;
}
this only resets the margins on the body; it doesn't affect anything else.
However
* {
margin: 0;
}
using the universal selector "*" will indeed reset the margins on
everything, and can have an impact on performance depending on how the
browser rendering is implemented.
It isn't that the universal selector "goes through all the tags", more
that it has to be checked every time a tag (more accurately, element) is
rendered, which can slow down rendering time (it has no effect on download
time); if you want some deep technical detail on how the WebKit engine
used in Safari, for example, goes about this, read Dave Hyatt's blog post
at <http://weblogs.mozillazine.org/hyatt/archives/2005_05.html#007507>
This is one reason why most modern reset-CSS files will specify all the
elements on which default margins and padding are to be zeroed: it
improves rendering speed if the "*" selector is not applied to absolutely
everything in the document. (It can still be of value without impairing
rendering efficiency unduly when applied at a more specific level, e.g.
"#example p *".)
Regards,
Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/
*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************