Skip to the content.
Color
Foreground Color
- The color property allows you to specify the color of text inside an element.
- You can specify any color in CSS in one of three ways
- RGB Values
- Hex Codes
- Color Names
Background Color
- CSS treats each HTML element as if it apperars in a box, and the background-color property sets the color of the background for that box.
Understanding Color
- Every color on a computer screen is created by mixing amounts of red, green, and blue.
- To find the color you want, you can use a color picker.
- RGB Values: values for red, green, and blue are expressed as numbers between 0 and 255.
- Hex Code: Hex values represent values for red, green and blue in hexadecimal code.
- Color Names: colors are represented by predefined names. However, they are very limited in numbers.
Contrast
- When picking foreground and background colors, it is important to ensure that there is enough contrast for the text to be legible.
CSS3: HSL Colors
- CSS3 introduces an entirely new and intuitive way to specify colors using hue, saturation, and lightness values.