CSS hsl() 函数 CSS 函数 实例 定义HSL 颜色: #p1{background-color:hsl(120,100%,50%);}/*绿色*/#p2{background-color:hsl(120,100%,75%);}/*浅绿*/#p3{background-color:hsl(120,100%,25%);}/*暗绿*/#p4{background-color:hsl(120,60%,70%);}/*柔和的绿色*/...
1. background-color属性的基本用法 background-color属性用于设置元素的背景颜色。其值可以是颜色名(如red)、十六进制颜色值(如#FF0000)、RGB(如rgb(255, 0, 0))、RGBA(如rgba(255, 0, 0, 0.5),其中A代表透明度)、HSL(如hsl(0, 100%, 50%))或HSLA(如hsla(0, 100%, 50%, 0.5))等格式。 css ...
0,0);/* RGB红色 */background-color:rgba(255,0,0,0.5);/* 半透明红色 */background-color:hsl(0,100%,50%);/* HSL红色 */background-color:hsla(0,100%,50%,0.5);/* 半透明HSL红色 */background-color:transparent;/* 透明 */
HSL被现代浏览器较好的支持,而且不需要任何前缀,IE6-IE7不支持。IE8支持该方式。 实例1:在css中直接使用hsl值 .test{background-color:hsl(360,50%,50%);} 实例2:使用Js修改dom时指定hsl值,以亮度为例 body{padding:100px;}#ex1Slider .slider-selection{background:#BABABA;}亮度: js //亮度$('#ex1'...
<color>是<color>描述背景的统一颜色的CSS 。即使background-image定义了一个或几个,如果图像不透明,透明度也会影响渲染效果。在CSS中,transparent是一种颜色。 正式语法 1 2 3 4 5 6 7 8 9 10 <color>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named...
backgroundcolor: hsl(210, 50%, 60%); /* 较深的蓝色 */ } /* 鼠标悬停时的按钮颜色 */ .button:hover { backgroundcolor: hsl(210, 50%, 70%); /* 较浅的蓝色 */ } /* 鼠标按下时的按钮颜色 */ .button:active { backgroundcolor: hsl(210, 40%, 50%); /* 更暗且去饱和的蓝色 *...
background-color:hsl(0,100%,50%); HSL即是代表色调,饱和度,亮度三个通道的颜色. h:Hue(色调)。 0(或360)表示红色,120表示绿色,240表示蓝色,当然可取其他数值来确定其它颜色. s:Saturation(饱和度)。 取值为0%到100%之间的值; e:Lightness(亮度)。 取值为0%到100%之间的值; 最后的a代表透明度。与rgb...
background-color:rgba(255,0,0,0.5); } 尝试一下 » HSL颜色 IE9, Firefox, Chrome, Safari 和 Opera 10+,支持 HSL 颜色值。 HSL 代表色相,饱和度和亮度 - 使用色彩圆柱坐标表示。 HSL 颜色值指定:HSL(色调,饱和度,明度)。 色相是在色轮上的程度(从0到360)-0(或360)是红色的,120是绿色的,240是...
创建一个定位twoclass 的 CSS 规则,并将其background-color属性设置为green。 此外,创建一个定位threeclass 的单独 CSS 规则,并将其background-color设置为blue。 步骤21 目前,有两种主要的颜色模型:用于电子设备的叠加RGB(红、绿、蓝)模型,以及用于打印的消减CMYK(青色、品红色、黄色,黑色)模型。
例如:background-color:rgba(192,192,192,0.5),用RGBA定义颜色不能像RGB一样使用HEX value(#c0c0c0)。 1.2 HSL && HSLA HSL色彩模式是工业界的一种颜色标准,是通过对色调(H)、饱和度(S)、亮度(L)三个颜色通道的变化以及它们相互之间的叠加来得到各式各样的颜色的,HSL即是代表色调,饱和度,亮度三个通道的颜...