HTML and CSS Reference
In-Depth Information
Compatibility
CSS 1, 2, 3
IE 4+
Netscape 6+, Firefox 1+
Opera 4+, Safari 1+
Note
• This property is often used to create a watermark effect similar to the proprietary
attribute of the <body> tag, bgproperties , introduced by Microsoft.
background-color
This property sets an element's background color. A wide variety of color values, as detailed
earlier in Table 5-4, can be used, while the default value, transparent , allows any
underlying content to show through.
Syntax
background-color: color | transparent | inherit
Examples
.red {background-color: #FF0000;}
.red2 {background-color: #F00;}
.red3 {background-color: red;}
.red4 {background-color: rgb(255, 0, 0);}
.red5 {background-color: hsl(0, 100%, 50%);}
Compatibility
CSS 1, 2, 3 IE 4+ Netscape 4 (buggy; may not fit
entire region), 6+, Firefox 1+
Opera 4+, Safari 1+
Notes
• This property is often used in conjunction with the color property. If both
properties are not set, it is possible to have rendering problems in the unlikely event
that the browser default colors hide content because colors are too similar. The W3C
CSS validator will warn of the possibility of this rare but troubling issue.
• Used with block elements, this property colors content and padding but not
margins.
background-image
This property associates a background image with an element. Underlying content may
show through transparent regions in the source image. The background image requires a
URL (complete or relative) to link it to the source image specified with the url( ) syntax.
The default value is none and sets the background so that it doesn't display an image.
Syntax
background-image: url(image-file) | none | inherit
Search WWH ::




Custom Search