7.2. Color in CSS

Elements that can be displayed in colors defined through style rules are:

  • backgrounds

  • borders

  • text

  • links

  • outlines

I've listed that last one for the sake of completeness. Outlines are not widely supported in any significant percentage of the browsers available today, so we won't spend time discussing them here. Refer to the outline property in Appendix B, if you're curious.

7.2.1. How to Specify Colors

When you specify a color for any CSS property that accepts color values, you have a choice of several methods:

  • descriptive color names

  • system color names

  • RGB decimal values

  • RGB hexadecimal values (including a three-character shorthand)

  • RGB percentage values

The most human-readable way to specify colors in HTML is to use key words ...

Get HTML Utopia: Designing Without Tables Using CSS now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.