[Cascading Style Sheets]
[Previous page] [Next page] [Section contents page]

Background and Color Properties and Values

Below are style properties and values for background images and color. (I've included here only properties now supported by Internet Explorer and Netscape -- I'll add others when they are supported)

Commonly Used Properties and Values for Cascading Style Sheets

Table Legend
IE3 Supported in Internet Explorer 3.x
IE4 Supported in Internet Explorer 4.x
N4 Supported in Netscape 4.x
pt = points
in = inches
cm = centimeters
px = pixels
em = height of element's font
(the em unit is not yet widely supported and should be used with caution)
  Property Description Values Example
Color and Background
IE3 IE4
N4
color (inherited) Sets color of text color-name
RGB triplet
hex code
RGB values
{ color: blue }
{ color: #00F }
{ color: #0000FF }
{ color: RGB 0.0 0.0 1.0 }
IE3 IE4
N4
background (not inherited) (for IE3.x, background images are supported only in embedded style sheets) Sets background images or colors url(URL) (with or without repeat);
color-name (or transparent, or two color names, which will be blended, separated by a / );
RGB triplet (hex code)
{ background: url(image1.gif) repeat }
{ background: Red }
{ background: Red / Blue }
{ background: transparent }
{ background: #CCCCCC }
IE3 IE4
N4
background-color (not inherited) (for IE3.x, background images are supported only in embedded style sheets) Sets background color color-name;
RGB triplet (hex code)
{ background-color: Red }
{ background-color: #CCCCCC }
IE4
background-image (not inherited) (for IE3.x, background images are supported only in embedded style sheets) Sets background image URL { background-image: url(image1.gif) }
IE4
background-repeat (not inherited) (for IE3.x, background images are supported only in embedded style sheets) Sets repetition to tile background images repeat (horizontally and vertically);
repeat-x (horizontal);
repeat-y (vertical);
no-repeat
{ background-repeat: repeat-y }
IE4
background-attachment (not inherited) (for IE3.x, background images are supported only in embedded style sheets) Fixes the background image or allows it to scroll with the page scroll or fixed { background: fixed }
IE4
background-position (not inherited) (for IE3.x, background images are supported only in embedded style sheets) Sets the initial position for background images
(Note that the default position, 0,0 or 0%,0%, is the upper-left corner of the element)
Position (x y) or (x% y%);
top, center, bottom
left, center, right
{ background-position: 2cm 1cm }
{ background-position: 50% 20% }
{ background-position: top center }
{ background-position: top }
{ background-position: bottom right }
[Previous page] [Next page] [Section contents page]