Personal tools
You are here: Home Library Development SILO Web Service Overviews Some Common CSS Properties

Some Common CSS Properties

The CSS syntax is made up of three parts: a selector, a property and a value:

selector {property: value}

(Extreme) Example:

p.mySelector {

    background-color: #ff0000;
    border-bottom-color: #000000;
    border-bottom-style: solid;
    border-bottom-width: 1px;
    font-family: arial, "lucida console", sans-serif;
    font-size: x-large;
    font-size: 10px;
    font-style: italic;
    font-weight: bold;
    margin-left: 10px;
    padding-bottom: 10px;
    text-align: center;

    display: none;  /* do not show element */

}

Background
background-color - the background-color property sets the background color of an element.

p { background-color: #00FF00; }

The color value can be a color name (red), a rgb value (rgb(255,0,0)), or a hex number (#FF0000) or may be "transparent".

background-image - The background-image property sets an image as the background.

background-image: url(stars.gif);

Border
border- The border property is shorthand for setting all of the properties for the four borders
in one declaration.

            width/style/color
p { border: thin dotted #00FF00; }

or

p
{
border-width: 1px;
border-style: dashed;
border-color: red;
}


One side of the element border may be customized by using one of the following:
border-bottom
border-top
border-left
border-right

p
{
border-top: 1px dotted blue;
}

or

p{
border-top-width: 2px;
border-top-style: solid;
border-top-color: red;
}

Font Examples

font-family: courier, serif;
font-family: arial, "lucida console", sans-serif;
font-size: x-large;
font-size: 10px;
font-size: 20%;
font-style: italic;
font-weight: bold;
font-weight: bold;

Margin Examples

margin-bottom, margin-top, margin-left, margin-right

margin-bottom: 10px;
margin-bottom: 5%;


Some other "common" examples ...

text-align: center;    (left,right,center,justify)
text-decoration: underline;  (none,underline,line-through)

Some Common Web-Browser Colors

Color
Color HEX Color RGB
black #000000 rgb(0,0,0)
 red #FF0000 rgb(255,0,0)
lime #00FF00
rgb(0,255,0)
 blue #0000FF rgb(0,0,255)
 yellow #FFFF00 rgb(255,255,0)
 aqua #00FFFF rgb(0,255,255)
 fuchsia #FF00FF rgb(255,0,255)
 gray #C0C0C0 rgb(192,192,192)
 white #FFFFFF rgb(255,255,255)



Related Sites
  • CSS Examples

    This link is to an excellent page that lets users make changes, click on a button, and see what the changes look like.

  • CSS2 References

    This is an excellent source of information for which properties apply to what selectors (more common selectors, anyway). The links in the "Property" column point to more useful information about each property including some examples.

Document Actions