CSS property color describes the foreground color of an element’s text content. In addition it is used to provide a potential indirect value (currentColor) for any other properties that accept color values.
CSS property color
| CSS version: | CSS 3 |
| Value: | color | inherit |
| Initial: | depends on user agent |
| Applies to: | all elements |
| Inherited: | yes |
| Animatable: | yes |
color values
Example – color
In the following code, CSS property color can be changed to the following values
- red
- #00ff00
- rgb(80%, 0%, 0%)
- rgb(80%, 0%, 0%, 0.5)
- transparent
- hsl(0, 100%, 50%)
- hsla(240, 100%, 50%, 0.5)
<style type="text/css" media="screen">
p {
color:red;
}
</style>
<p>Color of this text will change</p>color refresh