HTML and CSS Reference
In-Depth Information
Backgrounds are an integral part of styling an HTML document. Solid
colors, patterns, tiles, gradients, unconventional borders, and nonrect-
angular shapes can all be achieved by applying the various background
properties to the right element.
background-color
The
background-color
property is applied throughout the content area
of the element and is drawn behind any background-image that is set.
■
<color>
: The color of the background
■
transparent
: No color fill for the background (default)
background-image
The
background-image
property is used to specify a background image
for an element.
■
<uri>
: The path to the image file in the format
url(path)
or quoted
with single or double quotes such as
url("path")
and
url('path')
.
■
none
: No background image is used (default).
The
<uri>
, when a relative path, is calculated based on the location of
the document containing the given style rule and
not
the source HTML
document (unless they are one and the same). This way, you don't have
to worry about paths working the same from the HTML documents
index.html and /blog/2010/07/27/post-title. It also makes it easier to
move the assets together onto a new server or content delivery network.