Course contentsShow
← Web Development
Lesson 180 of 2,9823. CSS FundamentalsFree lesson

Color Keywords and Named Colors

Learn basic color keywords like 'red', 'blue', extended keywords, and when to use named colors in CSS.

Color Keywords and Named Colors

You'll learn: How to apply colors in CSS using simple, readable keyword names instead of complex color codes.

What Are Color Keywords?

CSS provides named colors — human-readable words that represent specific colors. Instead of memorizing hexadecimal codes or RGB values, you can simply write red, blue, or green directly in your stylesheets. Think of these like paint swatches at a hardware store, each with a convenient label on the can.

Basic Color Keywords

The most common color keywords include:

  • red, blue, green, yellow, orange, purple
  • black, white, gray
  • cyan, magenta, lime, navy

You use them anywhere a color value is expected:

h1 {
  color: darkblue;
}

p {
  background-color: lightgray;
  color: black;
}

Extended Color Keywords

Beyond the basics, CSS includes 147 named colors total. These range from aliceblue to yellowgreen, including shades like cornflowerblue, darkslategray, and mediumseagreen. These descriptive names make your CSS more readable at a glance.

When to Use Named Colors

Named colors work best for:

  • Prototyping — quick styling without looking up codes
  • Basic UI elements — straightforward colors like white backgrounds or black text
  • Readable code — tomato is easier to understand than #FF6347

For precise brand colors or complex designs, you'll eventually need hex codes or RGB values (covered in future lessons).

Key Takeaway: Color keywords let you apply colors using readable names like red or steelblue, making CSS easier to write and understand, especially for simple styling needs.