css设置背景图片模糊,内容不模糊
发布时间:2020-12-04
作者:呵呵后
来源:CSDN
浏览量(2)
点赞(0)
点踩(0)
评论(0)
收藏(0)
摘要:需求:一个div设置了background: url,现在需要使图片背景模糊,div内的文字清晰显示。原始代码:<!DOCTYPE html> .content { color: #ffffff; font-size: 40px; ...
<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8">
<style type="text/css">
.content {
color: #ffffff;
font-size: 40px;
}
.bg {
background: url('1.jpg');
background-repeat: no-repeat;
background-position: center;
background-size: cover;
height:600px;
text-align: center;
line-height: 600px;
}
</style>
</head>
<body>
<div class="bg">
<div class="content">我是内容</div>
</div>
</body>
</html><!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8">
<style type="text/css">
.content {
color: #ffffff;
font-size: 40px;
}
.bg {
background: url('1.jpg');
height:600px;
text-align: center;
line-height: 600px;
}
.bg-blur {
float: left;
width: 100%;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
-webkit-filter: blur(15px);
-moz-filter: blur(15px);
-o-filter: blur(15px);
-ms-filter: blur(15px);
filter: blur(15px);
}
.content-front {
position:absolute;
left: 10px;
height:600px;
line-height: 600px;
text-align: center;
}
</style>
</head>
<body>
<div>
<div class="bg bg-blur"></div>
<div class="content content-front">我是内容</div>
</div>
</body>
</html>扫一扫,手机访问
声明:本文由【达扬网络】编辑上传发布,转载此文章须经作者同意,并请附上出处【达扬网络】及本页链接。如内容、图片有任何版权问题,请联系我们进行处理。
上一篇:html5实现背景音乐的自动播放
下一篇:移动端复制的表格显示不全解决方法
相关内容
评头论足
现在,非常期待与您的一次邂逅
青海达扬网络传媒有限责任公司努力让每一次邂逅总能超越期待!
您身边的【数字化信息服务专家】
搜索千万次不如咨询1次
主营项目:国产化升级,小程序开发,软件开发,网络安全维护,app开发,数字信息化解决方案等
在线留言 问答社区 QQ咨询 0971-6275815
嘿,我来帮您!

