Easy Tutorial
❮ Att Textarea Rows Tag Ul ❯

HTML <body> background Attribute

HTML <body> Tag

Example

Set a background image for the document:


Browser Support

All major browsers support the background attribute.


Definition and Usage

The background attribute of <body> is deprecated in HTML 4.01.

The background attribute specifies the background image for the document.


Compatibility Notes

In HTML 4.01, the background attribute of the body element is deprecated; in XHTML 1.0 Strict DTD, the background attribute of the body element is not supported. Use CSS instead.

CSS Syntax: <body style="background-image:url(bgimage.jpg)">

CSS Example: Add a background image to the document

In our CSS tutorial, you can find more information about the background-image property.


Syntax

Attribute Values

Value Description
URL The URL of the background image. Possible values: absolute URL - points to another site (e.g., href="http://www.example.com/bgimage.gif")<br>relative URL - points to a file within the site (e.g., href="bgimage.gif")
❮ Att Textarea Rows Tag Ul ❯