About 2449 letters

About 12 minutes

#CSS Colors

PropertyDescriptionView
colorText colorView
background-colorBackground colorView

Ways to define colors in CSS:

  1. Color name, e.g., red, pink, green, etc.
  2. #RGBAR, G, and B are red, green, and blue channels; A is the alpha (opacity) channel. Each is a single hexadecimal digit (0f, case-insensitive).
  3. #RRGGBBAA — Each channel takes two hex digits.
  4. #RGB — A shorthand for #RRGGBB, without alpha.
  5. #RRGGBB — Full hex format, without alpha.
  6. rgb(R, G, B) — Each channel takes a value from 0 to 255.
  7. rgba(R, G, B, A) — Adds the alpha channel as a decimal from 0 (transparent) to 1 (opaque).

The alpha channel is used in blending when colors overlap. It typically controls the element's opacity.

#color

The color property sets the text color. For example:

<p style="color:pink;">Primers — Your programming companion</p> <p style="color:#39c5bb;">Primers — Your programming companion</p> <p style="color:rgb(102, 204, 255);">Primers — Your programming companion</p>

HTML

#background-color

The background-color property sets the background color of an element. For example:

<p style="background-color:pink;">Primers — Your programming companion</p> <p style="background-color:#39c5bb;">Primers — Your programming companion</p> <p style="background-color:rgb(102, 204, 255);">Primers — Your programming companion</p>

HTML

#Standard Color Names

HTML/CSS Standard Color Names

Created in 5/20/2025

Updated in 6/5/2025