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 Color | Hexadecimal | RGB (Decimal) |
|---|
| Black | #000000 | 0, 0, 0 |
| Silver | #C0C0C0 | 192, 192, 192 |
| Gray | #808080 | 128, 128, 128 |
| White | #FFFFFF | 255, 255, 255 |
| Maroon | #800000 | 128, 0, 0 |
| Red | #FF0000 | 255, 0, 0 |
| Purple | #800080 | 128, 0, 128 |
| Fuchsia | #FF00FF | 255, 0, 255 |
| Green | #008000 | 0, 128, 0 |
| Lime | #00FF00 | 0, 255, 0 |
| Olive | #808000 | 128, 128, 0 |
| Yellow | #FFFF00 | 255, 255, 0 |
| Navy | #000080 | 0, 0, 128 |
| Blue | #0000FF | 0, 0, 255 |
| Teal | #008080 | 0, 128, 128 |
| Aqua | #00FFFF | 0, 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.