Careeroza
Colors
CSS Color Values
| Format | Example | Notes |
|---|---|---|
| Name | tomato | 140+ predefined names |
| HEX | #ff6347, short #f63 | most common in design tools |
| RGB / RGBA | rgb(255 99 71), rgb(255 99 71 / 50%) | red, green, blue 0–255; optional alpha |
| HSL / HSLA | hsl(9 100% 64%) | hue (0–360), saturation, lightness: easy to make shades |
| currentColor | border-color: currentColor | the element's text color |
Example
Example
HSL makes lighter and darker shades easy: only the last number changes:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
div { padding: 10px; color: white; font-family: Arial; }
.c1 { background: hsl(152, 95%, 25%); }
.c2 { background: hsl(152, 95%, 34%); }
.c3 { background: hsl(152, 95%, 45%); }
.c4 { background: hsl(152, 95%, 34% / 0.4); color: black; }
</style>
</head>
<body>
<div class="c1">hsl(152, 95%, 25%)</div>
<div class="c2">hsl(152, 95%, 34%)</div>
<div class="c3">hsl(152, 95%, 45%)</div>
<div class="c4">40% opacity</div>
</body>
</html>Result
Contrast
Tip: Text must stand out from its background: aim for a contrast ratio of at least 4.5:1 for normal text (WCAG AA). DevTools shows the ratio when you inspect a color.