Member-only story
HTML — Part-2
5 min readMay 7, 2022
HTML Colors
- HTML supports 140 standard color names.
- Colors can be specified by name (red, tomato) or using RGB values, HEX values, HSL values, RGBA values, and HSLA values.
- rgb(255, 99, 71), #ff6347, hsl(9, 100%, 64%)
1. RGB Color Values
rgb(red, green, blue)
- rgb(0, 0, 0) — black
- rgb(255, 255, 255) — white
2. RGBA Color Values
rgba(red, green, blue, alpha)
The alpha parameter is a number between 0.0 (fully transparent) and 1.0 (not transparent at all)
3. HTML HEX Colors
#rrggbb — Where rr (red), gg (green) and bb (blue) are hexadecimal values between 00 and ff (same as decimal 0–255).
- #ffffff — white
- #000000 — black
4. HTML HSL and HSLA Colors
HSL stands for hue, saturation, and lightness. A- alpha(opacity)
- hsl(0, 100%, 100%) — white
- hsl(0, 0%, 0%) — black
Hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, and 240 is blue.
Saturation can be described as the intensity of a color.
100% — pure color, 50% — 50% grey shade on color, 0% completely grey.