CSS color Property

If this site has been useful, we’d love your support! Running this site takes time and resources, and every small contribution helps us keep creating valuable content. Consider buying us a coffee to keep things going strong!

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

The rusty swing set creaked a lonely lullaby in the twilight, shadows lengthening like grasping fingers across the dew-kissed grass. A lone dandelion seed, adrift on the breeze, whispered secrets of faraway fields, of dandelion suns and galaxies spun from fluff. Somewhere, beyond the veil of dusk, a coyote laughed, echoing through the stillness like a forgotten memory.

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
Edge Chrome Firefox Opera Safari
12113.51
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
18410.1114.4

Last updated by CSSPortal on: 1st January 2024