XML technologies / CSS / Advanced websites with CSS / CSS property reference / color

(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)

The property color describes an element’s foreground colour. It also sets the default colour for the element’s border.

Whenever an element’s foreground colour is set, its background colour should also be defined, and vice versa. This prevents problems with the user’s browser settings.

Inherited: yes

See also: background-color

Values

Any valid CSS colour value.

Default value: black

Compatibility

CSS version: 1

Works in all CSS-capable browsers, including Internet Explorer 4 and later, Netscape 4 and later, and Mozilla.

Example

The following style rule displays all paragraphs on the page as white text on a tomato-red background.

p {
 color: white;
 background-color: #ff6347;
}

  

 

 

 

back to top