当前位置: 移动技术网 > IT编程>网页制作>CSS > css设置背景模糊

css设置背景模糊

2018年10月22日  | 移动技术网IT编程  | 我要评论

使用filter属性来设置模糊值

效果:

 

css样式:

 

<style type="text/css">
        .cover {
            width: 600px;
            height: 300px;
            position: relative;
            text-align: center;
            line-height: 300px;
            color: #fff;
            margin: 20px auto;
        }
        
        .cover::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 600px;
            height: 300px;
            background: transparent url(images/picture/5.jpg) center center no-repeat;
            filter: blur(8px);
            z-index: -1;
            background-size: cover;
        }
    </style>

 

html结构:

<body>
    <div class="cover">
        <h2>背景模糊,文字清晰显示</h2>
    </div>
</body>

  

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网