This webpage is updated by Len Hom on May 1, 1999

This is an example of a background color for an element in the embedded stylesheet, but not on the linked stylesheet. The linked stylesheet supercedes the embedded stylesheet since no background color is shown here.

Len's Stylesheet 4 - Adding Borders/Backgrounds Using Linked and Embedded CSS

Adding Borders

You can add a border around a heading, list, paragraph, etc, with a < DIV > element, i.e.

div.box { border: solid; border-width: thin }

which can be used with markup as follows:

< DIV CLASS=" box " >

The content within this DIV element will be enclosed in a box with a thin line around it.


Setting the Background

A nice effect is to paint the background in the box with a solid color or with a tiled image. To do this you use the background property, i.e.

div.color {
background: rgb( 204,204,255 )
padding: 0.5em;
border: none;
}

If you have any comments or questions, please send email to:

Len Hom


Back [Back Button] Next [Next Button] Return to Beginning of Page


I take full responsibility for the information posted. The information on this page represents that of myself and not that of California State University, Sacramento or the School of Engineering and Computer Science