首页 > 其他 > 详细

转载 | 如何实现模块半透明 文字内容不透明?

时间:2017-08-18 23:07:28      阅读:254      评论:0      收藏:0      [点我收藏+]

两种方法

一种是用background:rgba(0, 0, 0, 0.5),兼容性只支持IE8往上另一种方法使用透明度

要考虑IE8往下可以用这个:

<style type="text/css">
.box{ 
    position:relative; 
    width:200px; 
    height:200px; 
    border:1px solid #666; 
    z-index:0;
}

.box .bg{ 
    background:red; 
    position:absolute; 
    z-index:-1; 
    opacity:0.5; 
    filter:alpha(opacity=50); 
    width:100%; 
    height:100%;
}
</style>

<div class="box">
    <!-- 背景 -->
    <div class="bg"></div>
    <!-- 内容 -->
    <div class="text">
        <p>呵呵,我不受透明度影响!</p>
    </div>
</div>

 

转载 | 如何实现模块半透明 文字内容不透明?

原文:http://www.cnblogs.com/One-sprite/p/7392459.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!