background property (body)
Sets or retrieves the background picture, which will be tiled to provide the body background.
This property is deprecated.
Use the background style property instead: 'body {background: url(bg.jpg);}'.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: background |
Possible values:
String that sets or retrieves the URL of the picture. It can be an absolute or relative path as well. Relative paths are relative to the base URL. The base URL is the location of the current document, but it can be overridden by the base tag.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the background attribute:
|
||||
<body background="bg.gif" bgproperties="fixed"> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
Recommendation:
|
||||
<body style="background:url(bg.gif) fixed no-repeat;"> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 3:
This example illustrates the use of the background property:
|
||||
<head> <script type="text/javascript"> function ChangeBg () { document.body.background = "bg.jpg"; } </script> </head> <body background="bg.gif" bgproperties="fixed"> <button onclick="ChangeBg ();">Change the background</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
HTML elements:
Related pages:
External links:
User Contributed Comments