Skip to main content

HTML Guide

CSS: “color”: “X” is not a “color” value.

The color property in CSS expects a valid color value. Valid color values include keywords (such as red or blue), hexadecimal values (such as #FFFFFF), RGB values (such as rgb(255, 255, 255)), and others.

Example Fix

Invalid CSS

The following snippet is invalid because 0 is not a valid color value:

<style>
  .example {
    color: 0;
  }
</style>

Valid CSS

To fix it, use a valid color value. Below are examples using different types of color values:

Color Keyword
<style>
  .example {
    color: black;
  }
</style>
Hexadecimal Color
<style>
  .example {
    color: #000000;
  }
</style>
RGB Color
<style>
  .example {
    color: rgb(0, 0, 0);
  }
</style>
RGBA Color
<style>
  .example {
    color: rgba(0, 0, 0, 0.5);
  }
</style>

Learn more:

Related W3C validator issues