Code Log 4: CSS Color
How Does CSS Use Color?
CSS uses color as one of the ways to modify the appearance of web pages. There are many different properties that CSS uses to change the color, but here are some of the following:
- Color - it sets the foreground color of an element’s text
- Background-color - it sets the background color of an element
- Border-color - it sets the border color of an element
How Does CSS Accept Color as a Value?
CSS uses color in many different formats, so here are some of the following with the color white being demonstrated as an example:
- Named - predefined keywords (white)
- Hexadecimal - six digit code (#0000ff)
- RGB - rgb function with values for red, green, and blue (rgb(255, 255, 255))
- RGBAS - the rgb function with an alpha channel for modifying opacity (rgba(255, 255, 255, 1))
Sample Code