微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用CSS3模糊div后面的内容

我在将绝对/固定元素的背景应用模糊时遇到了问题,因为它似乎不会模糊页面的主要内容,只会模糊绝对元素本身的内容.我目前的警报样式如下:

.alert-wrap {
    position: fixed;
    z-index: 10;
    right: 0;
    bottom: 0;
}

.alert-wrap .alert {
    display: block;
    background-color: rgba(215,44,0.5);
    margin: 0 15px 15px 0;
    position: relative;
}

.alert-wrap .alert:before {
    content: "";

    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;

    -webkit-filter: blur(10px);
    -moz-filter: blur(10px);
    -o-filter: blur(10px);
    -ms-filter: blur(10px);
    filter: blur(10px);

}

我希望这会模糊警报元素的背景,使其背后的主要内容看起来模糊(更多地关注元素本身),但是甚至没有找到任何确认存在这个问题的东西.

HTML文档流程如下:

PHP
            //constructing navbar
        ?>

        
PHP //constructing footer ?>

图片示例:

最佳答案
我已经更新了这个关于模糊内容评论…这是更好的处理like this.

这将模糊背景和所有内容,但不会模糊警报.

enter image description here

HTML:

display='block';">Go

CSS

.content {

}

.alerting {
    -webkit-filter: blur(10px);
    -moz-filter: blur(10px);
    -o-filter: blur(10px);
    -ms-filter: blur(10px);
    filter: blur(10px);
}

#alert {
    display: none;
    width: 300px;
    height: 100px;
    position: fixed;
    top: 100px;
    left: 0;
    text-align: center;
    width: 100%;
}

原文地址:https://www.jb51.cc/css/427224.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。