我在将模糊应用于绝对/固定元素的背景时遇到了问题,因为它似乎只能模糊绝对元素本身的内容,而不能模糊页面的主要内容。我目前的警报样式如下所示:
我想让这个模糊背景警报元素,使其后面的主要内容看起来模糊(更加关注元素本身),但我还没有找到任何证实这个问题存在的东西。
HTML文档流如下:
图像示例:
.alert-wrap {
position: fixed;
z-index: 10;
right: 0;
bottom: 0;
}
.alert-wrap .alert {
display: block;
background-color: rgba(215, 44, 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文档流如下:
<html>
<head>
<!-- Header Stuff Deleted -->
</head>
<body>
<div class='alert-wrap'>
<div class='alert'>
<div class='head'>
Notifications
</div>
<div class='body'>
Alert content here
</div>
</div>
</div>
<?php
//constructing navbar
?>
<div class='content'>
Some content here
</div>
<?php
//constructing footer
?>
</body>
</html>
图像示例: