Reputation: 2617
I was playing around with css and discovered problems in browsers like ie7 with margins, I ended up styling the html tag in the css for things to look good. How is it that the html tag can be styled when the body tag is supposed to be the start of the visible portion of a html document?
Upvotes: 0
Views: 61
Reputation: 723448
Actually, in terms of CSS, the viewport is the canvas where all the contents of a page are drawn, followed by html
, the root of an HTML document, followed by body
, the document body. The body
element may be the start of an HTML document where visible content may be placed, but it's not the root of the view canvas, at least as far as CSS is concerned.
And for that matter, even head
and its contents may be styled, not just html
, body
and the contents of body
. In fact, browsers that implement CSS actually have to apply display: none
to the head
element in their user agent stylesheets in order to hide it.
Upvotes: 5