HTML color



HTML colors are a mixture of red, green, and blue.


Color Values

HTML colors are defined by a hexadecimal notation consisting of red, green and blue values ​​​​(RGB). The minimum value for

colors is 0 (hex: #00). The maximum value is 255 (hex: #FF).

This table gives the specific effect of mixing three colors:

Example

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>php中文网(php.cn)</title> 
</head> 
<body>

<p style="background-color:#FFFF00">
通过十六进制设置背景颜色
</p>

<p style="background-color:rgb(255,255,0)">
通过 rbg 值设置背景颜色
</p>

<p style="background-color:yellow">
通过颜色名设置背景颜色
</p>

</body>
</html>

Running example »

Click the "Run Instance" button to view the online instance


16 million different colors

Three colors The combination of red, green and blue ranges from 0 to 255, a total of 16 million different colors (256 x 256 x 256).

In the color table below you will see different results, red from 0 to 255, while setting the green and blue values ​​​​to 0, as the red value changes, different values ​​​​are displayed different colors.

Red LightColor HEXColor RGB
 #000000 rgb(0,0,0)
 #080000rgb(8,0,0)
 #100000rgb(16,0,0)
 #180000rgb(24,0,0)
 #200000rgb(32,0,0)
 #280000rgb(40,0,0)
 #300000rgb(48,0,0)
 #380000rgb(56,0,0)
 #400000rgb(64,0,0)
 #480000rgb(72,0,0)
 #500000rgb(80,0,0)
 #580000rgb(88,0,0)
 #600000rgb(96,0,0)
 #680000rgb(104,0,0)
 #700000rgb(112,0,0)
 #780000rgb(120,0,0)
 #800000rgb(128,0,0)
 #880000rgb(136,0,0)
 #900000rgb(144,0,0)
 #980000rgb(152,0,0)
 #A00000rgb(160,0,0)
 #A80000rgb(168,0,0)
 #B00000rgb(176,0,0)
 #B80000rgb(184,0,0)
 #C00000rgb(192,0,0)
 #C80000rgb(200,0,0)
 #D00000rgb(208,0,0)
 #D80000rgb(216,0,0)
 #E00000rgb(224,0,0)
 #E80000rgb(232,0,0)
 #F00000rgb(240,0,0)
 #F80000rgb(248,0,0)
 #FF0000rgb(255,0,0)


Gray tones

The following shows the gradient from gray to black

Gray ShadesColor HEXColor RGB
 #000000 rgb(0,0,0) 
 #080808 rgb(8,8,8) 
 #101010 rgb(16,16,16) 
 #181818 rgb(24,24,24) 
 #202020 rgb(32,32,32) 
 #282828 rgb(40,40,40) 
 #303030 rgb(48,48,48) 
 #383838 rgb(56,56,56) 
 #404040 rgb(64,64,64) 
 #484848 rgb(72,72,72) 
 #505050 rgb(80,80,80) 
 #585858 rgb(88,88,88) 
 #606060 rgb(96,96,96) 
 #686868 rgb(104,104,104) 
 #707070 rgb(112,112,112) 
 #787878 rgb(120,120,120) 
 #808080 rgb(128,128,128) 
 #888888 rgb(136,136,136) 
 #909090 rgb(144,144,144) 
 #989898 rgb(152,152,152) 
 #A0A0A0 rgb(160,160,160) 
 #A8A8A8 rgb(168,168,168) 
 #B0B0B0 rgb(176,176,176) 
 #B8B8B8 rgb(184,184,184) 
 #C0C0C0 rgb(192,192,192) 
 #C8C8C8 rgb(200,200,200) 
 #D0D0D0 rgb(208,208,208) 
 #D8D8D8 rgb(216,216,216) 
 #E0E0E0 rgb(224,224,224) 
 #E8E8E8 rgb(232,232,232) 
 #F0F0F0 rgb(240,240,240) 
 #F8F8F8 rgb(248,248,248) 
 #FFFFFF rgb(255,255,255) 


Web-safe colors?

A few years ago, when most computers supported only 256 colors, a set of 216 Web-safe colors was proposed as a Web standard. The reason for this is that Microsoft and Mac operating systems use 40 different reserved fixed system colors (approximately 20 each).

We're not sure how meaningful this is nowadays, as more and more computers are capable of processing millions of colors, but the choice is yours.

Initially, 216 cross-platform web-safe colors were used to ensure that all computers could display all colors correctly when using a 256-color palette.

##FF6600FF6633FF6666FF6699FF66CCFF66FF## FF9900#FFCC00#FFFF00
0000000000330000660000990000CC0000FF
0033000033330033660033990033CC0033FF
0066000066330066660066990066CC0066FF
0099000099330099660099990099CC0099FF
00CC0000CC3300CC6600CC9900CCCC00CCFF
00FF0000FF3300FF6600FF9900FFCC00FFFF
3300003300333300663300993300CC3300FF
3333003333333333663333993333CC3333FF
3366003366333366663366993366CC3366FF
3399003399333399663399993399CC3399FF
33CC0033CC3333CC6633CC9933CCCC33CCFF
33FF0033FF3333FF6633FF9933FFCC33FFFF
660000 6600336600666600996600CC6600FF
663300 #6633336633666633996633CC6633FF
6666006666336666666666996666CC6666FF
6699006699336699666699996699CC6699FF
66CC0066CC3366CC6666CC9966CCCC66CCFF
66FF0066FF3366FF6666FF9966FFCC66FFFF
9900009900339900669900999900CC9900FF
9933009933339933669933999933CC9933FF
9966009966339966669966999966CC9966FF
9999009999339999669999999999CC9999FF
99CC0099CC3399CC6699CC9999CCCC99CCFF
99FF0099FF3399FF6699FF9999FFCC99FFFF
CC0000CC0033CC0066CC0099CC00CCCC00FF
CC3300CC3333CC3366CC3399CC33CCCC33FF
CC6600CC6633CC6666CC6699CC66CCCC66FF
CC9900CC9933CC9966CC9999CC99CCCC99FF
CCCC00CCCC33CCCC66CCCC99CCCCCCCCCCFF
CCFF00CCFF33CCFF66CCFF99CCFFCCCCFFFF
FF0000FF0033FF0066FF0099FF00CCFF00FF
#FF3300FF3333FF3366FF3399FF33CCFF33FF
FF9933FF9966FF9999FF99CCFF99FF
FFCC33FFCC66FFCC99FFCCCCFFCCFF
FFFF33FFFF66FFFF99FFFFCCFFFFFF