39 of 313 menu

The color property

The color property sets a text color text. The property value is any color units. The default value is usually black.

Syntax

selector { color: color; }

Example

Let's give the element red color:

<div id="elem"> Lorem ipsum dolor sit amet. </div> #elem { color: red; }

:

Example

The color property sets a color not only for a text, but also for list items:

<ul> <li>list item</li> <li>list item</li> <li>list item</li> <li>list item</li> <li>list item</li> </ul> li { color: red; }

:

Example

The color property also sets a border color (if it is not specified in border-color):

<div id="elem"> Lorem ipsum dolor sit amet. </div> #elem { color: red; border-style: solid; border-width: 2px; }

:

byenru