0% found this document useful (0 votes)
20 views

Learn CSS - Colors Cheatsheet - Codecademy

CSS provides several ways to specify colors including hexadecimal codes, RGB values, HSL values, color names, and alpha transparency levels. Hexadecimal colors use six-digit codes to represent red, green, and blue values. RGB and HSL values use functions to define colors with numbers for red, green, blue or hue, saturation, and lightness. Color names are predefined words that represent common colors. Alpha transparency values between 0 and 1 can be added to RGBA and HSLA colors to make them see-through.

Uploaded by

manojschavan6
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Learn CSS - Colors Cheatsheet - Codecademy

CSS provides several ways to specify colors including hexadecimal codes, RGB values, HSL values, color names, and alpha transparency levels. Hexadecimal colors use six-digit codes to represent red, green, and blue values. RGB and HSL values use functions to define colors with numbers for red, green, blue or hue, saturation, and lightness. Color names are predefined words that represent common colors. Alpha transparency values between 0 and 1 can be added to RGBA and HSLA colors to make them see-through.

Uploaded by

manojschavan6
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

12/26/23, 11:01 AM Learn CSS: Colors Cheatsheet | Codecademy

Cheatsheets / Learn CSS

Colors

CSS Color Alpha Values

Alpha values determine the transparency of colors in .midground {


CSS. Alpha values can be set for both RGB and HSL
background-color: rgba(0, 255, 0, 0.5);
colors by using rgba() and hsla() and providing a
fourth value representing alpha. Alpha values can range }
between 0.0 (totally transparent) and 1.0 (totally
opaque).
.foreground {
The CSS transparent value can also be used to create
a fully transparent element. background-color: hsla(34, 100%, 50%,
0.1);
}

.transparent {
color: transparent;
}

CSS Hexadecimal Colors

CSS colors can be represented in hexadecimal (or hex) .red {


notation. Hexadecimal digits can represent sixteen
color: #ff0000;
different values using 0 - 9 and a - f .
Hexadecimal colors are composed of 6 characters– }
each group of two represents a value between 0 and
255 for red, green, or blue. For example #ff0000 is all
.short-blue {
red, no green, and no blue.
When both characters of all three colors are repeated, color: #00f;
hex colors can be abbreviated to only three values, so }
#0000ff could also be represented as #00f .

CSS HSL Colors

CSS colors can be declared with the HSL color system .light-blue {
using hsl() syntax. This syntax contains three values:
background-color: hsl(200, 70%, 50%);
hue (the color value itself), saturation (intensity), and
lightness. }
Hue values range from 0 to 360 while saturation and
lightness values are represented as percentages.

https://www.codecademy.com/learn/learn-css/modules/learn-css-colors/cheatsheet 1/2
12/26/23, 11:01 AM Learn CSS: Colors Cheatsheet | Codecademy

CSS rgb() Colors

CSS colors can be declared with RGB colors using .hot-pink {


rgb() syntax.
color: rgb(249, 2, 171);
rgb() should be supplied with three values
representing red, green, and blue. These values range }
can from 0 to 255.

.green {
color: rgb(0, 255, 0);
}

Color Name Keywords

Color name keywords can be used to set color h1 {


property values for elements in CSS.
color: aqua;
}

li {
color: khaki;
}

Print Share

https://www.codecademy.com/learn/learn-css/modules/learn-css-colors/cheatsheet 2/2

You might also like