Colors Values in CSS

CSS has several different variations for specifying color. They are HEX (long and shorthand), Color Keywords, RGB, RGBA, HSA, HSLA.

/* Hex - short */
color: #ddd;

/* Hex - long */
color: #F04530;

/* Color Keyword */
color: red;

/* RGB */
color: rgb(255,255,255);

/* RGBA */
color: rgba(200, 54, 54, 0.5);

/* HSL */
color: hsl(166, 92%, 50%)

/* HSLA */
color: hsla(128, 42%, 50%, 0.61)

Note: Some browsers don’t like RGBA, HSL and HSLA. Use with caution.

Want to become a better web developer?

Join over 25,000 other developer & designers who get awesome links to the best news and articles each week delivered directly to their inbox.

This post currently has no responses. What do you think?

You can use basic HTML when posting code, please turn all < characters into &lt; or > into &gt;
If the code is multi-line, use <pre><code></code></pre>

Leave a Reply

Your email address will not be published. Required fields are marked *