HTML White Code

This page contains HTML code for coloring an element white. You can use these HTML codes for setting the text color, background color, or the border color to white.

White Text

One way of setting the text color to white is by using inline styles. In the following example, I use the HTML <p> tag along with the style attribute.

You could also apply the styles against a <div> tag (for all text within that element) or even the <body> tag (for all text on the page).

Note that most browsers display a background color of white. Therefore, to display white text you will need to change the background color to a color that contrasts enough with the white text, that the text is readable. In this example, I set the background color to black, and the text color to white.

Source CodeResult

White text

Here's the same thing, but this time using embedded styles.

Source CodeResult

White text

You could also place the CSS code into a external style sheet.

White Border Color

You can create a white border around an element, however, the element will need to be contained within another element with a non-white background (otherwise you'll have white on white — unreadable to the human eye).

In this example, I've nested a <div> element inside of another one. The outer <div> has a background color of black. The inner <div> has a 3 pixel border with a color of white and a background color of orange.

Source CodeResult
I have a white border.

White Color Codes

The above examples use white as the color value. I could just as easily used the hexadecimal or RGB color values and the result would've been the same.

Here are the various methods of specifying the color white in HTML.

Source CodeResult

White text

White text (hexadecimal #ffffff)

White text (hexadecimal shorthand #fff)

White text (RGB value rgb(255,255,255))

Shades of White

Here are some different shades of whites and "whitish" colors that can be used instead of just plain old "white".

Color Name Hex Code RGB Decimal Code RGB
White FFFFFF 255,255,255
Snow FFFAFA 255,250,250
Honeydew F0FFF0 240,255,240
MintCream F5FFFA 245,255,250
Azure F0FFFF 240,255,255
AliceBlue F0F8FF 240,248,255
GhostWhite F8F8FF 248,248,255
WhiteSmoke F5F5F5 245,245,245
Seashell FFF5EE 255,245,238
Beige F5F5DC 245,245,220
OldLace FDF5E6 253,245,230
FloralWhite FFFAF0 255,250,240
Ivory FFFFF0 255,255,240
AntiqueWhite FAEBD7 250,235,215
Linen FAF0E6 250,240,230
LavenderBlush FFF0F5 255,240,245
MistyRose FFE4E1 255,228,225