CSS color Property
Description
The CSS property color is used to specify the text color of an HTML element. It allows web developers to define the foreground color of text content, providing a wide range of options from named colors like "red" and "blue" to hexadecimal color codes or RGB values for precise color customization. By setting the "color" property, designers can ensure text is visually appealing and complements the overall aesthetics of a web page, making it easier to convey information and enhance the user experience.
- Initial value
- Depends on the user agent. For example, your browser sets its own default colors for different elements.
- Applies to
- All elements
- Inherited
- Yes
- Computed value
- For a non-translucent color, an hexadecimal equivalent is used. Otherwise it is the RGBa equivalent
- Animatable
- Yes
- JavaScript syntax
- object.style.color
Interactive Demo
Syntax
color: <color> | inherit
Values
- <color>Is a color value giving the color of the textual elements of the element.
- inherit
Example
<div class="color">Example off the CSS color property.</div>
<div class="color1">Lets change the value of color.</div>
.color {
color: #0000FF;
}
.color1 {
color: #800000;
}
Browser Support
The following table will show you the current browser support for the CSS color property.
| Desktop | |||||
![]() |
![]() |
![]() |
![]() |
![]() |
|
| 12 | 1 | 1 | 3.5 | 1 | |
| Tablets / Mobile | |||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| 18 | 4 | 10.1 | 1 | 1 | 4.4 |
Last updated by CSSPortal on: 1st January 2024






