CSS颜色表示方法:
1、用颜色名表示
如:white、red、greenyellow、gold等。
2、用十六进制的颜色值表示(红、绿、蓝)
#FF0000或者#F00
3、用rgb(r,g,b)函数表示
如:rgb(255,255,0)
4、用hsl(Hue,Saturation,Lightness)函数表示(色调、饱和度、亮度)
如:hsl(120,100%,100%),色调0代表红色,120代表绿色,240代表
蓝色
5、用rgba(r,g,b,a)函数表示
其中a表示的是改颜色的透明度,取值范围是0~1,其中0代表完全透明。
6、用hsla(Hue,Saturation,Lightness,alpha)函数表示
色调、饱和度、亮度、透明度
Note: The list of accepted keywords has undergone many changes during the evolution of CSS:
- CSS Level 1 only included 16 basic colors, called the VGA colors as they were taken from the set of displayable colors on VGA graphics cards.
- CSS Level 2 added the orange keyword.
- Although various colors not in the specification (mostly adapted from the X11 colors list) were supported by early browsers, it wasn't until SVG 1.0 and CSS Colors Level 3 that they were formally defined. They are called the extended color keywords, the X11 colors, or the SVG colors.
- CSS Colors Level 4 added the
rebeccapurplekeyword to honor web pioneer Eric Meyer. - (注意:在css的进化过程中,被接受的关键字列表经历了许多变化:
css 1级只包括16种基本颜色,称为vga颜色,因为它们取自vga显卡上的一组可显示的颜色。
css 2级添加了橙色关键字。
虽然早期的浏览器支持不在规范中的各种颜色(大多是从x11颜色列表中改编而来),但直到svg 1.0和css颜色等级3才被正式定义。它们被称为扩展颜色关键字、x11颜色或svg颜色。
css颜色等级4添加了红色关键字,以纪念网络先驱Eric Meyer。)








浙公网安备 33010602011771号