HTML body background Attribute

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)">


<body background="URL">

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="")
  • A relative URL - Is used to navigate within a site (like background="background.jpg")

Browser Support

The attribute is supported in all major browsers.


<body background="background.jpg">
<p>Welcome to</p>
HTML body background Attribute Reviewed by 1000sourcecodes on 08:44 Rating: 5
Powered by Blogger.