X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Body background Property

Body Object Reference Body Object

Definition and Usage

The background property sets or returns the value of the background attribute of the body element.

The background attribute specifies a background image for a document.

Syntax

bodyObject.background=URL


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The background property is supported in all major browsers.


Example

Example

Return the value of the background attribute of the body element:

<html>
<body id="w3s" background="w3s.png">

<script>
document.write("The background image is: ")
document.write(document.getElementById("w3s").background);
</script>

</body>
</html>

Try it yourself »


Body Object Reference Body Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook