Do you put the background-property in the html or the body element?
Asked by
klaas4 (
2194)
September 9th, 2009
I generally doesn’t make much difference, right? Just curious..
Observing members:
0
Composing members:
0
6 Answers
As far as I know, it only works with the body, but I don’t use html much so I could be wrong.
It does work with body and html, but not in combination with each other. At least not well.
btw I usually use the body tag. That’s the most standard, but maybe someone else has a reason to choose otherwise.
You have a background for your body. Are you using inline CSS or a stylesheet, btw?
As has been noted already, the background image is an attribute of the HTML <body> tag.
Also:
(1) Be sure you’re using CSS to implement a background image. The HTML tag attribute approach may work, but only because browsers are forgiving on backwards compatibility – which doesn’t mean it’s The Right Way to Do It :)
(2) more details: http://www.w3schools.com/css/pr_background-image.asp
I usually look at the meaning of the tags. <html> indicates the HTML document, <body> the content of the displayed HTML, which is where you want to set the background properties of.
Answer this question
This question is in the General Section. Responses must be helpful and on-topic.