html Color Representation
There are three ways to express colors in web pages:
Color words: blue, green, red, yellow
red light(red), green light(green), blue(blue).
In computers, each primary color uses 8-bit binary (2^8 = 256), so RGB can represent a total of 256*256*256 = 16.7 million colors. When using hexadecimal to represent color: use 2 hexadecimal digits to represent 1 digit of the primary color.Color words | ##red | green | blue | yellow |
Decimal | rgb(255,0,0) | ##rgb(0,255,0) ## rgb(0,0,255) | rgb(255,255,0) | |
#FF0000 | #00FF00 | #0000FF | #FFFF00 | ##Note: Decimal compatibility is not good, so use it as little as possible. Decimal color representation, commonly used in CSS. |
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>这是我们的第一个页面</title> </head> <body> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <table border="1" rules="all"> <tr> <td bgcolor="#FF0000" width="50">红</td> <td bgcolor="#FF0055" width="50"></td> <td bgcolor="#FF00bb" width="50"></td> </tr> <tr> <td bgcolor="#00FF00" width="50">绿</td> <td bgcolor="#00FF55" width="50"></td> <td bgcolor="#00FFbb" width="50"></td> </tr> <tr> <td bgcolor="#0000FF" width="50">蓝</td> <td bgcolor="#0055FF" width="50"></td> <td bgcolor="#00bbFF" width="50"></td> </tr> </table> </body> </html>