首页 > Web开发 > 详细

css实现背景模糊,但不影响背景上的内容

时间:2019-02-13 12:08:09      阅读:293      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>高斯模糊背景</title>
    <style>
        .bg{
            background-image:url(../images/1.jpg);
            width:100%;
            height:750px;
            line-height:750px;
        }
        .bg-blur{
            float:left;
            background-position:center;
            background-repeat:no-repeat;
            background-size:cover;
            -webkit-filter: blur(9px);
            -moz-filter: blur(9px);
            -o-filter: blur(9px);
            -ms-filter: blur(9px);
            filter:blur(9px);

        }
        .content{
            font-size:50px;
            color:#555;
            font-weight:bold;
        }
        .font-content{
            position:absolute;
            width:700px;
            height:700px;
            margin:20px;
            text-align:center;
            line-height:700px;
            left:50%;
            top:50%;
            transform: translate3d(-50%,-50%,0);
            /* border:2px solid red; */
        }
    </style>
</head>
<body>
<div>
    <div class="bg bg-blur"></div>
    <div class="content font-content">今天是植树节,你植树了吗?</div>
</div>
</body>
</html>

效果如下:

技术分享图片

css实现背景模糊,但不影响背景上的内容

原文:https://www.cnblogs.com/liubingyjui/p/10369036.html

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