HTML & CSS
/Beginner
Colors
Definition
CSS allows you to apply colors to text, backgrounds, and borders using several different formats: Keywords, HEX, RGB/RGBA, and HSL/HSLA.
Explain Like I'm New
There's more than one way to say 'Red'. You can use the word `red`, the Hexadecimal code `#ff0000`, the RGB mix `rgb(255, 0, 0)`, or the Hue-Saturation-Lightness mix `hsl(0, 100%, 50%)`. The 'A' in RGBA and HSLA stands for 'Alpha' (transparency).
Real World Example
Creating a beautiful glassmorphism effect using `rgba(255, 255, 255, 0.5)` to make a white background 50% see-through.
Common Use Cases
- •Theming
- •Gradients
- •Opacity and transparency
Interactive Example
Interview Questions
basic
- What does the 4th value in `rgba(0, 0, 0, 0.5)` do?
intermediate
- Why do designers prefer HSL over HEX codes?