Latest

recent

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

Syntax

<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="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 1000sourcecodes.com</p>
</body>
</html>
HTML body background Attribute Reviewed by 1000sourcecodes on 08:44 Rating: 5
Powered by Blogger.