General Question

klaas4's avatar

Do you put the background-property in the html or the body element?

Asked by klaas4 (2181points) September 9th, 2009

I generally doesn’t make much difference, right? Just curious..

Observing members: 0 Composing members: 0

6 Answers

chronohart's avatar

As far as I know, it only works with the body, but I don’t use html much so I could be wrong.

klaas4's avatar

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.

five99one's avatar

You have a background for your body. Are you using inline CSS or a stylesheet, btw?

gt4329b's avatar

As has been noted already, the background image is an attribute of the HTML <body> tag.

(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:

pygeek's avatar

As @gt4329b was saying, make sure you freshen up on your CSS. The CSS background property may be used for elements within <body>, including the body itself. Here’s a CSS reference sheet for all CSS properties:

good luck!

Vincentt's avatar

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




to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
Knowledge Networking @ Fluther