English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
This article introduces the usage of the HTML body background attribute, including online examples demonstrating how to use the HTML body background attribute, browser compatibility, syntax definition, and detailed information about its attribute values.
Specify a background image for the document:
<!DOCTYPE html> <html> <head> <title>HTML:<body> background attribute - basic tutorial website oldtoolbag.com</title> <body background="/static/images/bgimage.gif"> <h1>Hello world!/h1> <p><a href="https://www.oldtoolbag.com">Visit the basic tutorial website!/a></p> </body> </html>Test to see ‹/›
IEFirefoxOperaChromeSafari
All mainstream browsers support the background attribute.
HTML5 The background attribute of <body> is no longer supported. Please use CSS instead.
The background attribute of <body> in HTML 401 The feature has been deprecated.
The background attribute specifies the background image of the document.
In HTML 401 It is not recommended to use the background attribute of the body element; in XHTML 1In HTML 4.0 Strict DTD, the background attribute of the body element is not supported. Please 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 about background-image attributeknowledge.
<body background="URL">
Value | Description |
---|---|
URL | URL of the background image. Possible values:
|