Reputation: 11689
I can actually set the background-color of the html tag. I didn't know it was possible and I don't understand if it's logically correct, I thought the body was the only one responsable to contain and the "first" rendered tag. I thought html tag was just a wrapper but it looks different. So,
- What exactly represents the html tag?
- Why can I set it's background-color?
- Will it give me problems?
I resized body to a 1024 x 768 size and want to set its background color to white, while html page to black, it's quite nice in this way... I would like to know if I must use div for this (I hate a lot of divs!!!)
Upvotes: 1
Views: 174
Reputation: 54729
A browser will render it that way. Styles on the actual HTML element are perfectly fine. In fact, the default style sheet for HTML 4 sets the <html>
element to be display: block
. It is a visible element and it can be stylized.
Adding styles to the root element doesn't change its semantic meaning, only how it's displayed. As long as you're not altering the semantic meaning of elements, you're fine. Style away.
Upvotes: 5