Basic Code Snippets

color: crimson;
color: #4D66CF;
color: rgb(158, 6, 213);

Additional Examples

This text is colored green by using one of the standardized HTML Color Names; in this case, we simply used the color name "green".

Lorem ipsum dolor sit amet, This text is color red by using a hexadecimal color, such as #FF0000. Quaerat consequatur ipsa fugiat quibusdam vitae eum ipsum ipsam totam, nisi voluptatibus quae debitis non magnam quis cumque perferendis porro neque corporis.

The text in these paragraphs inside of the div element are colored a light purple by using the special "functional notation" syntax for a function called rgb().

"r" stands for red, "g" stands for green, and "b" stands for blue. Each color channel accepts a value between 0 and 255. In this case, we used rgb(164, 88, 215).

Notice that a more specific CSS selector will have a higher priority than a less specific CSS selector in having their CSS rule applied. That's why this text is red: Class Selectors are more specific than HTML Element Selectors.

Additional Resources

w3schools
mdn web docs