码迷,mamicode.com
首页 > Web开发 > 详细

css为图片添加一层蒙版并在上层显示文字等

时间:2019-10-28 12:44:20      阅读:762      评论:0      收藏:0      [点我收藏+]

标签:http   absolute   src   代码   nbsp   jpg   top   添加   效果   

效果图:

技术图片

代码如下:

<div class="row" style="width:100%; position:relative;z-index:1;margin:0 auto; background: #000;">
    <img src="~/images/touxiang.jpg" style="width:100%; opacity:0.6; filter: alpha(opacity=60);"/>
    <div style="width:100%;position:absolute;z-index:2;top:50%; text-align:center;">
        <h2 style="color:#fff">文字浮动在图片上方</h2>
    </div>
</div>

 

css为图片添加一层蒙版并在上层显示文字等

标签:http   absolute   src   代码   nbsp   jpg   top   添加   效果   

原文地址:https://www.cnblogs.com/yechangzhong-826217795/p/11751192.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!