HTML and CSS Reference
In-Depth Information
define the descriptors once in a separate file and reference that file us-
ing the definitions-src descriptor.
8.4.5. Color and Background Properties
Every element in your document has a foreground and a background
color. In some cases, the background is not one color, but a colorful im-
age. The color and background style properties control these colors and
images.
The children of an HTML/XHTML element normally inherit the foreground
color of their parent. For instance, if you make <body> text red, the
styles-conscious browser also displays header and paragraph text in
red.
Background properties behave differently, howeverthey are not inher-
ited. Instead, each element has a default background that is transpar-
ent, allowing the parent's background to show through. Thus, setting
the background image of the <body> tag does not cause that image to
be reloaded for every element within the body tag. Instead, the browser
loads the image once and displays it behind the rest of the document,
serving as the background for all elements that do not themselves have
an explicit background color or image.
All the current popular browsers support the following background and
color properties.
8.4.5.1. The background-color property
The background-color property controls the (you guessed it!) back-
ground color of an element. Set it to a color value or to the keyword
transparent (the default value). The effects should be obvious.
While you may have become accustomed to setting the background col-
or of an entire document through the special attributes for the <body>
tag, you can apply the background-color style property to any element.
 
Search WWH ::




Custom Search