By the end of this lesson, students will understand:
| Format | Example | Notes |
|---|---|---|
| Name | red, green, blue |
Basic colors |
| HEX | #ff0000 |
Very common |
| RGB | rgb(255, 0, 0) |
Red, Green, Blue |
| RGBA | rgba(255,0,0,0.5) |
Same + transparency |
| HSL | hsl(0, 50%, 50%) |
Hue, Saturation, Lightness |
.box {
background-color: red;
}
.box {
background-color: #ff0000;
}
.box {
background-color: #f00; /* same as #ff0000 */
}
.box {
background-color: rgb(255, 0, 0);
}
.box {
background-color: rgba(255, 0, 0, 0.5); /* 0.5 = 50% transparent */
}
.box {
background-color: hsl(0, 100%, 50%); /* red */
}