QUICK LINKS

COLORS

With 16,777,216 colors at your disposal, there shouldn’t be any reason you can’t find a color to your liking in css. When calling upon them in code, there are three different forms color can take. The two most common are an rgb value and a hex code, though there are also 17 predefined color names that are acceptable as well.

For example, the same color red can be called in the following ways: red, rgb(255,0,0), rgb(100%, 0%,0%), #ff0000, and #f00. The word red by itself will be recognized, while the rgb values can be determined with numbers between 0 and 255, or percentages. Hex codes range from #000000 (black) to #ffffff (white). However something like #ffffff can be shortened to #fff.

Any image-editing program can provide specific values of colors when choosing from a color palette. When choosing from the predefined colors, any of the following will work: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow.

When customizing white text in the p tag it would most likely appear as either of the following:

p {
      color: white;
      }

p {
      color: #fff;
      }


Quick Reference

Predefined colors
Include red, blue, black, white, etc

rgb(255,255,0)
An rgb value ranging from 0 to 255

rgb(100%,100%,0)
An rgb value ranging from 0% to 100%

#000000
A hex code for black

#000
A shortened hex code for #000000 or black