CSS colorsColor valuesCSS lets you specify 24-bit colors (that's 16,777,216 colors!) for properties such as text color, background color and border color to spice up your designs. You can either use color names, hexadecimal notation or RGB (red, green, blue) notation. CSS color namesTo make things easier, CSS includes 16 standard color names in plain English as well as over 100 extended color names. Here's a list of the standard ones:
Additionally you can set a color value to either none or transparent to prevent the element from drawing any color (other elements behind it will show through). Hexadecimal colorsAlthough color names come in quite handy sometimes, they're far too few to suit every design. To tap into the full range of 24-bit colors you can use hexadecimal values. Hexadecimal colors are made up of a # pound sign followed by a 6-digit hexadecimal number like
Maybe you've noticed that I wrote RGB colorsLast but not least you can also specify color values using the RGB model (red, green, blue). It's basically like hexadecimal colors but instead of hex pairs you're using decimal values from 0 to 255 for each color component like
You can already see that the RGB notation produces longer code than the hexadecimal notation while doing exactly the same thing. For this reason RGB is rarely used over hex. Most graphics software display colors in both RGB and hex format anyway. Text colorThe CSS color:p {color:green}
Output:Background colorThe CSS background-color:p {background-color:yellow}
Output: |