HTML body background Attribute
HTML <body> tag
Definition and Usage
The background attribute specifies the URL of an image to use as a background for a page.
Compatibility Notes
The background attribute of the body element was deprecated in HTML 4.01
and is not supported in XHTML 1.0 Strict DTD.
Use CSS instead.
CSS syntax: <body style="background-image: url(background.jpg)">
In our CSS tutorial you can find more details about the
background-image property.
Syntax
Syntax Example
<body background="background.jpg">
|
Attribute Values
Value |
Description |
URL |
The web resource/address of the background image.
Possible values:
- An absolute URL - Is used to navigate to another web site (like
background="www.example.com/background.jpg")
- A relative URL - Is used to navigate within a site (like background="background.jpg")
|
Browser Support

The attribute is supported in all major browsers.
Example
<html>
<body background="background.jpg">
<p>Welcome to W3Schools.</p>
</body>
</html>
|
Try-It-Yourself Demos
body
background attribute example
Set the background image with the body background attribute.
In CSS:
background-image example
Set the background image with CSS.
HTML <body> tag
 |

|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|