Utilizor
Contact Us

CSS Color Values

Learn about different CSS color value formats: HEX, RGB, RGBA, HSL, HSLA.

CSS Color Values

In CSS, colors can be specified in various formats.

HEX Colors

A hexadecimal color is specified with: #RRGGBB.

Example: #FF0000 is Red.

RGB Colors

An RGB color value is specified with: rgb(red, green, blue).

Example: rgb(255, 0, 0) is Red.

RGBA Colors

RGBA color values are an extension of RGB color values with an alpha channel - which specifies the opacity for a color.

Example: rgba(255, 0, 0, 0.5) is semi-transparent Red.

HSL Colors

HSL stands for Hue, Saturation, and Lightness.

Example: hsl(0, 100%, 50%) is Red.

Example

/* Different ways to define red */
.hex { color: #FF0000; }
.rgb { color: rgb(255, 0, 0); }
.hsl { color: hsl(0, 100%, 50%); }