RGB格式。
RGBA格式。
十六进制表示法。
HSL。
HSLA。
内置颜色。
color: rgb(R, G, B);
color:rgba(R, G, B, A);
color:#(0-F)(0-F)(0-F)(0-F)(0-F)(0-F);
color:hsl(H, S, L);
color:hsla(H, S, L, A);
color: color-name;
S.no。 | 颜色名称 | 十六进制值 | 十进制值或rgb()值 |
1。 | Red | #FF0000 | rgb(255,0,0) |
2。 | Orange | #FFA500 | rgb(255,165,0) |
3。 | Yellow | #FFFF00 | rgb(255,255,0) |
4。 | Pink | #FFC0CB | rgb(255,192,203) |
5。 | Green | #008000 | rgb(0,128,0) |
6。 | Violet | #EE82EE | rgb(238,130,238) |
7。 | Blue | #0000FF | rgb(0,0,255) |
8。 | Aqua | #00FFFF | rgb(0,255,255) |
9。 | Brown | #A52A2A | rgb(165,42,42) |
10。 | White | #FFFFFF | rgb(255,255,255) |
11。 | Gray | #808080 | rgb(128,128,128) |
12。 | Black | #000000 | rgb(0,0,0) |
<html>
<head>
<title>CSS hsl color property</title>
<style>
h1{
text-align:center;
}
#rgb{
color:rgb(255,0,0);
}
#rgba{
color:rgba(255,0,0,0.5);
}
#hex{
color:#EE82EE;
}
#short{
color: #E8E;
}
#hsl{
color:hsl(0,50%,50%);
}
#hsla{
color:hsla(0,50%,50%,0.5);
}
#built{
color:green;
}
</style>
</head>
<body>
<h1 id="rgb">
Hello World. This is RGB format.
</h1>
<h1 id="rgba">
Hello World. This is RGBA format.
</h1>
<h1 id="hex">
Hello World. This is Hexadecimal format.
</h1>
<h1 id="short">
Hello World. This is Short-hexadecimal format.
</h1>
<h1 id="hsl">
Hello World. This is HSL format.
</h1>
<h1 id="hsla">
Hello World. This is HSLA format.
</h1>
<h1 id="built">
Hello World. This is Built-in color format.
</h1>
</body>
</html>