You are here: Reference > HTML > attributes > background (body)

background attribute (body)

Browser support:
Sets the background picture, which will be tiled to provide the body background.
This attribute is deprecated. Use the background style property instead: 'body {background: url(bg.jpg);}'.
JavaScript page for this attribute: background. You can find other example(s) there.

Possible values:

String that sets the URL of the picture. It can be an absolute or relative path as well. Relative paths are relative to the base URL. The base URL is the location of the current document, but it can be overridden by the base tag.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the background attribute:
<body background="bg.gif" bgproperties="fixed">
</body>
Did you find this example helpful? yes no

Example HTML code 2:

Recommendation:
<body style="background:url(bg.gif) fixed no-repeat;">
</body>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content