HTML and CSS Reference
In-Depth Information
Background Properties
here is little point in controlling the foreground color of text if there isn't also
a way to specify background colors. he background-color property does just
that, using the same color value notation as the foreground color property. For
body { background-color: #eee; } /* very light gray */
ul.hilite { background-color: yellow; }
div.tip { background-color: rbg(204,204,255); } /* light blue */
he background color ills the entire area occupied by the element, includ-
ing the padding and extending to the outer edge of the border. he HTML
code in Example 3.8 features a division with a fat dotted border. he result is
shown in Figure 3.8.
Example 3.8: HTML and CSS for background colors
<!DOCTYPE html>
<title>Example 3.8</title>
<style type="text/css">
body { background-color: #aaa; } /* light gray page */
div { color: white; /* white text and border */
width: 100px;
height: 160px;
margin: 36px;
font-size: 4em;
border: 10px dotted; /* not a solid border */
background-color: #333; /* dark gray background */
<div align="center"> 1 &cent;</div>
Search WWH ::

Custom Search