CSS

2.2 Common CSS Properties

Contents

color

The color property specifies the color of any text, links, borders, and more. There are 140 color names available or you can specify your colors using hexadecimal color values.



p{
    color:red;
}

background-color

The background-color property specifies the background color of the page, headlines, paragraphs, and more.



p{
    background-color:green;
}

This example sets the background color of paragraphs to green. If you wanted the entire page background to be green you would use body as the selector.

width

The width property specifies the width (horizontal size) of the element. The unit of measurement in this example is px for pixels.



p{
    width:500px;
}