Search within TutorialsPark

CSS Color Property


To set the color of text contents or elements decoration


Definition and Notes.

1. The CSS color property defines the foreground color of an element's text content or its decoration(underline, overline etc) and even to the border unless overridden by border-color.

2. The color can be set using various way like Hex Codes, rgba() , hsla() or even keywords.

Syntax:

CSS color property. internetexplorer safari firefox opera chrome

View in Splitscreen»

Code-Editor:

Note- The color property has a cascading effect, hence its inherited by child elements unless specified otherwise .

Property Values

Value Description
color To set the text color.Any option can be used i.e Hex Codes, rgba(), hsla() or keywords.
inherit If specified, the child element inherits the color of the parent element

Specifications

Specs Value
Name color
Value <color>
Initial Value User-agent Specific
Applies to All Elements
Javascript syntax object.style.color="#fa4b2a"
Inherited Yes
Computed Value Same as declared Value.
Browser Support internetexplorer safari firefox opera chrome

Related Examples.