Color Values in CSS

Color Values in CSS

Overview of Color in CSS

  • CSS (Cascading Style Sheets) allows web designers to specify colors through various methods.

Types of Color Values in CSS

1. Color Keywords
  • Defined list of basic colors that can be used in styling.
  • Limited to specific predefined names.
2. CSS3 Color Specification
  • The CSS3 specification includes 16 basic color names that can be utilized within web pages.
3. Extended Color Keywords
  • Beyond the basic colors, CSS3 includes a more extensive list of extended color keywords supported by web browsers.
  • Example of usage with extended color:
    css p { color: darkgoldenred; }

Color Names and Their Corresponding sRGB Values

  • Defined as named numeric values and hexadecimal representations.
Basic Color Names:
  • The following are the 16 basic colors included in the CSS3 specification:
Named ColorHexadecimalRGB (Decimal)
Black#0000000, 0, 0
Silver#C0C0C0192, 192, 192
Gray#808080128, 128, 128
White#FFFFFF255, 255, 255
Maroon#800000128, 0, 0
Red#FF0000255, 0, 0
Purple#800080128, 0, 128
Fuchsia#FF00FF255, 0, 255
Green#0080000, 128, 0
Lime#00FF000, 255, 0
Olive#808000128, 128, 0
Yellow#FFFF00255, 255, 0
Navy#0000800, 0, 128
Blue#0000FF0, 0, 255
Teal#0080800, 128, 128
Aqua#00FFFF0, 255, 255

Additional Methods for Color Specification

  • CSS supports alternative ways for web designers to specify colors, allowing for customized palettes outside the predefined lists.