脚本宝典收集整理的这篇文章主要介绍了css3支持的颜色表示方法有哪些,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
css3颜色表示方法有:1、用颜色英文名称来表示,例“red”表示红色;2、用十六进制来表示,例“#ffff00”;3、使用rgb()函数来表示;4、使用hsl()函数来表示;5、使用rgba()函数来表示;6、使用hsla()函数来表示。
本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
色光三原色原理@H_512_15@
色光的三原色是 红色(Red)、绿色(Green)、蓝色(Blue) 三种,可以构成缤纷的绚丽色彩。
CSS3支持的颜色表示方法
示例:
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html" ;charset="utf-8"> <tITle>CSS颜色表示</title> <style type="text/css"> div>div{ width: 400px; height: 40px; } </style> </head> <body> <script type="text/javascript"> for (VAR i = 0; i < 300; i++) { document.write("CSS颜色表示"); } </script> <div style="position:absolute;top:0px"> <div style="background-color:gray;"> background-color:gray </div> <div style="background-color:#ff4314;"> background-color:#888 </div> <div style="background-color:#ffff00;"> background-color:#ffff00 </div> <div style="background-color:rgb(0, 255, 255);"> background-color:rgb(0, 255, 255) </div> <div style="background-color:hsl(120, 100%, 50%);"> background-color:hsl(120, 100%, 50%) </div> <div style="background-color:rgba(0, 255, 255, 0.5);"> background-color:rgba(0, 255, 255, 0.5) </div> <div style="background-color:hsla(120, 100%, 50%, 0.5);"> background-color:hsla(120, 100%, 50%, 0.5) </div> </div> </body> </html>
网页展示
说明
之所以在后面加文字,是为了验证透明度。
(学习视频分享:css视频教程、web前端)
以上就是css3支持的颜色表示方法有哪些的详细内容,更多请关注脚本宝典其它相关文章!
以上是脚本宝典为你收集整理的css3支持的颜色表示方法有哪些全部内容,希望文章能够帮你解决css3支持的颜色表示方法有哪些所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。