About White
White (white) is a very light, muted white with the hex code #ffffff, or rgb(255, 255, 255). In HSL it sits at a hue of 0°, 0% saturation and 100% lightness. It is one of the 148 named colors every browser understands, so you can write color: white; instead of the hex value.
Using White for text and backgrounds
| Pairing | Contrast ratio | WCAG |
|---|---|---|
| White text on white | 1.00 : 1 | fails |
| White text on black | 21.00 : 1 | AAA |
On a white background, use black text (21.00 : 1). WCAG asks for at least 4.5 : 1 for body text and 3 : 1 for large text. Check other pairs with the Contrast Checker.
CSS
.element {
color: white; /* or #ffffff */
background-color: #ffffff;
border: 1px solid rgb(255 255 255 / 50%);
}
Similar named colors
Snow (#fffafa), Ghost White (#f8f8ff), Mint Cream (#f5fffa), Azure (#f0ffff), Ivory (#fffff0), Floral White (#fffaf0).