CSS Color Syntax

By Xah Lee. Date: . Last updated: .

Interactive Color Picker

Value is:

Basic Named Colors

black #000000 white #ffffff silver #c0c0c0 gray #808080 red #ff0000 maroon #800000 yellow #ffff00 olive #808000 lime #00ff00 green #008000 aqua #00ffff teal #008080 blue #0000ff navy #000080 fuchsia #ff00ff purple #800080 orange #ffa500

CSS code example:

p {color:red}

Complete CSS Color Names

RGB Hexadecimal Syntax

The RGB color model uses 3 values, for {Red, Green, Blue}, each with a value range from 0 to 255, in 2 hexadecimal digits.

Example:

p { color: #ffc0cb }

[see Binary/Hexadecimal Converter]

RGB Hexadecimal Syntax Shortcut

When using hexadecimal, if digit for each value are repeated, it can be abbreviated to just 3 hexadecimal digits. Like this:

color: #0f7

same as

color: #00ff77

RGB Integer Syntax

RGB color by integer, 0 to 255

p { color: rgb(255, 192, 203) }

RGB Percent Syntax

p { color: rgb(100%, 75%, 79%) }

HSL Color Syntax

p {color: hsl( 0, 100%, 50%)}

Opacity

CSS Color