Home CSS Backgrounds Background Color Codes
Search MS Office A-Z   |   Search Web Pages/ Design A-Z

Background Color Codes

Action Code
Color Behind A Centered Background Image background: #31CEFF url(bgimage.jpg) no-repeat center;
Uneven Background Colors

At times, you want an element to have a different background color than the rest of the document. It's a good way to add contrast and draw visitors' attention to important information.

The standard way to add background color is like this:

P {background:yellow}

When you apply that style definition in the document, you expect the entire paragraph to have a yellow background. That's what you get in Explorer and Netscape 6.x, but Netscape 4.x versions only put the background color behind the text.

Avoid this ragged effect by adding a 1 pixel border to the style declaration and setting the border color to the same color as your background.

P.contact {background:yellow; border:1px yellow}

That will give you the effect you want in both Netscape and Explorer.



Home CSS Backgrounds Background Color Codes
Search MS Office A-Z   |   Search Web Pages/ Design A-Z