求问CSS设置css 背景半透明透明问题

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
您的访问请求被拒绝 403 Forbidden - ITeye技术社区
您的访问请求被拒绝
亲爱的会员,您的IP地址所在网段被ITeye拒绝服务,这可能是以下两种情况导致:
一、您所在的网段内有网络爬虫大量抓取ITeye网页,为保证其他人流畅的访问ITeye,该网段被ITeye拒绝
二、您通过某个代理服务器访问ITeye网站,该代理服务器被网络爬虫利用,大量抓取ITeye网页
请您点击按钮解除封锁&CSS让div背景透明
时间: 23:19:48
浏览次数:
div背景透明样式:
样式代码:
.alert{filter:alpha(opacity=100); /* IE */ -moz-opacity:1.0; /* Moz + FF */
opacity: 1.0; height:300 width:500 background:# left:50%; top:50%;margin-top:-150margin-left:-250position:z-index:99; text-align: padding:20}
使用方法:
&div class=&alert&&
html代码:
&!DOCTYPE html PUBLIC &-//W3C//DTD XHTML 1.0
Transitional//EN& &http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&&
&html xmlns=&http://www.w3.org/1999/xhtml&&
&meta http-
equiv=&Content-Type& content=&text/ charset=utf-8& /&
&title&&/title&
&style type=&text/css&&
{filter:alpha(opacity=100); /* IE */ -moz-opacity:1.0; /* Moz + FF */ opacity: 1.0; height:300 width:500 background:# left:50%; top:50%;margin-top:-150margin-left:
-250position:z-index:99; text-align: padding:20px}
&div class=&alert&&&/div&CSS 背景透明_CSS教程_前端技术
您的位置: &
& 详细内容
&!DOCTYPE html PUBLIC &-//W3C//DTD XHTML 1.0 Transitional//EN& &http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&&
&html xmlns=&http://www.w3.org/1999/xhtml&&
&meta http-equiv=&Content-Type& content=&text/ charset=utf-8& /&
&title&无标题文档 - &/title&
&style type=&text/css&&
*{margin:0}
body{ background-image:url(sdfsdfds.jpg); }
background:rgba(0, 0, 0, 0.4) none repeat scroll 0 0 !/*实现FF背景透明,文字不透明*/
filter:Alpha(opacity=40); background:#000000;/*实现IE背景透明*/ (这里是关键)
color:#FFF;
height:500
border:1px solid #FF0;
font-size:18
text-align:
font-weight:
margin-top:120
.div p{position:} (这里position:relative样式必须有,否则IE下内容也跟着透明了!!!)
&div class=&div&&&p&我是文字&/p&&/div&
( 09:32:40)
( 09:32:39)
( 09:32:37)
( 09:32:35)
( 09:32:34)
( 09:32:29)
( 09:32:28)
( 09:32:26)
相关排行总榜设置元素的透明度:
&-moz-opacity:0.8; /*在Firefox中设置元素透明度
&filter: alpha(opacity=80); /*ie使用滤镜设置透明
但是当我们对一个标签设置背景的透明度时,往往我们并不希望该标签上的文字图片也变成半透明了。
&&div&&p&不透明&/p&&/div&
div{-moz-opacity:0.3;filter:alpha(opacity=30);background:#000;width:500
&height:500color:#F30; font-size:32 font-weight: }
可以很明显的看出文字也被半透明的,这是我们不想看到的效果。
&以前我曾经是绝对定位的方法解决这个问题,也就是现在的p并不是div的子元素。
&div&&/div&
&&p&不透明&/p&
这样div的半透明效果也就不会影响到元素p了。最后在将p定位到需要的位置。
&但是很多时候这样的标签并不是很合理,有可能还会多浪费几个标签。
下面的这种方法就可以解决上面的问题了:
&div{background:rgba(0,0,0,0.2) none repeat scroll ! /*实现FF背景透明,文字不透明*/
background:#000; filter:Alpha(opacity=20);/*实现IE背景透明*/&
&width:500 height:500 color:#F30; font-size:32 font-weight:}
&div p{ position:}/*实现IE文字不透明*/
火狐我们直接用rgba颜色就可以解决子标签跟着半透明的问题了,但是ie还不是能很好的支持。
&所以我们给不想被透明的标签设置一个定位属性,问题接能解决了。
文字来自:/l_lihanyu/blog/static//
阅读(...) 评论()

我要回帖

更多关于 css 背景半透明 的文章

 

随机推荐