HTML and CSS Reference
5.3. Document Colors and Background Images
The HTML 4 and XHTML standards provide a number of attributes for the
<body> tag that let you define text, link, and document background colors,
in addition to defining an image to be used as the document background.
All the popular browsers additionally extend these attributes to include
document margins and better background image control. And, of course,
the latest stylesheet technologies integrated into the current browsers let
you manipulate all of these various display parameters.
5.3.1. Additions and Extensions to the <body> Tag
The attributes that control the document background, text color, and
document margins are used with the <body> tag. [ <body>, 3.8.1 ]
22.214.171.124. The bgcolor attribute
One standard, although deprecated, way you can change the default
background color in the browser window to another hue is with the bgcol-
or attribute for the <body> tag. Like the color attribute for the <font> tag,
the required value of the bgcolor attribute may be expressed in either
of two ways: as the red, green, and blue (RGB) components of the de-
sired color, or as a standard color name. Appendix G provides a complete
discussion of RGB color encoding along with a table of acceptable color
names you can use with the bgcolor attribute.
Setting the background color is easy. To get a pure red background using
RGB encoding, try:
For a subtler background, try: