Home > Web Front-end > HTML Tutorial > CSS如何设置div半透明效果_html/css_WEB-ITnose

CSS如何设置div半透明效果_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:31:20
Original
1338 people have browsed it

CSS如何设置div半透明效果:
设置元素的透明度在很多应用中都有使用,下面就介绍一下如何设置一个元素为半透明,其他的透明效果自己衍伸就可以了。
代码实例如下:

 

<!DOCTYPE html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style type="text/css">div{   filter:alpha(opacity=50);    opacity:0.5;   width:100px;  height:100px;  background-color:green;} </style></head><body><div></div></body></html>
Copy after login

 

opacity属性所以标准浏览器都支持,但是IE8和IE8以下浏览器不支持此属性,于是就使用filter:alpha(opacity=50)进行兼容,opacity的取值是0-1,但是filter下的那个取值是0-100。opacity属性可以参阅CSS的opacity属性一章节。

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=9651

更多内容可以参阅:http://www.softwhy.com/divcss/

 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template