CSS - color


Description:

The color property sets the foreground color of an element (typically, the color of the text).

Possible Values:

  • color: should be any valid color value.

Applies to:

All the HTML elements.

DOM Syntax:

object.style.color="#a1a1a1";

Example:

Here is the example which shows effect of this property:

<h2 style="color:olive;">
This text will have olive color.
</h2>

<p style="color:#3300CC">
This text will have blue color.
</p>

<div style="color:rgb(224,37,197);">
This text will have pink color.
</div>
     

This will produce following result:

This text will have olive color.

This text will have blue color.

This text will have pink color.

 

 





Spacer Bottom Left Corner ImageBottom Right Corner Image
Valid XHTML 1.0 Strict  Valid CSS! Check the accessibility of this site according to U.S. Section 508