Search code examples
htmlcsssemantic-markup

Should we be applying CSS to <body> vs. <html> elements?


Possible Duplicate:
Should global css styles be set on the html element or the body element?

There's some really interesting discussion about applying CSS to <html> and <body> in order to get some cool effects — like two background images, one transparent (but CSS3 may render that useless).

However, for the standard cases, which element is most appropriate to use for appling page-wide CSS to?

Perhaps there's even some CSS properties that are better suited to one selector over the other? Thus, split among the two?

(This concerns things like cross-browser compatibility, as well as proper semantics according to spec.)

And we can also bring the wildcard * { } selector into this discussion.


Solution

  • I believe that the W3C recommends that you apply any page-wide styles to the <body> element.