css3中颜色的几种表示法:
1.英文颜色单词;
2.rgb(n,n,n);
3.rgba(n,n,n,m),m为0到1之间的数,表示透明度;
4.hsl(颜色(色轮值),饱和度,亮度) 又称色轮模式;
透明度问题:
opacity 设置透明度
transparent 绝对透明 相当于透明度设置为1
<!DOCTYPE html>
<html>
<head>
<title>css3新增属性测试</title>
<meta charset="utff-8">
<style type="text/css">
body{background: red}
/*div{width: 300px;height: 200px; background: rgba(0,255,0,0.5);}*/
/*div{width: 300px;height: 200px; background: hsl(120,50%,50%);}*/
div{width: 300px;height: 200px; background:rgb(0,255,0);opacity:0.5;}
</style>
</head>
<body>
<div>Hello CSS3!!</div>
</body>
</html>
结果演示: