English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The CSS color property defines the foreground color of the element.
Thecolor
Properties usually define the color of the text content of the element.
For example, in the selectorcolor
specified attributebody
Define the default text color for the entire page (usually the foreground color).
body {color: #000000;}Test to see‹/›
Colors in CSS are usually specified by the following methods:
Hexadecimal Values-For example, '#ff0000'
RGB Values-For example, 'rgb('255,0,0)
Color Names-such as 'red'
View CSS color names to get the complete list of possible color names.
Thecolor
Properties are not only used for text content but also for all content using color values in the front-end. For example, if the element has not been explicitly definedborder-color
oroutline-color
Value, then the color value will be used.
p.one { color: #0000ff; border: 2px solid; } p.two { color: #00ff00; outline: 2px solid; }Test to see‹/›
Note:Thecolor
Properties usually inherit the color value from their parent element,AnchorExcluding Elements.