html - 我怎样才能模糊整个身体而不是唯一的一个div?
问题描述
我希望突出显示的白色 div 框后面的整个区域都应该模糊,但不是 div
解决方案
将此添加到您的 body 元素(或您想要显示模糊的那个)的 CSS 中。
body {
filter: blur(8px);
-webkit-filter: blur(8px);
}
那8px
是模糊效果的强度,可以根据需要进行更改。
这是一个例子:
body,
html {
height: 100%;
}
.parent {
height: 100%;
width: 100%;
position: fixed;
background: url("https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg");
background-size: cover;
filter: blur(3px);
z-index: 5;
-webkit-filter: blur(3px);
}
.child {
height: 200px;
width: 200px;
z-index: 10;
top: 50%;
left: 50%;
margin: -100px 0 0 -100px;
position: fixed;
background: url("https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg");
background-size: cover;
}
<div class="parent">
</div>
<div class="child"></div>
推荐阅读
- android - 更改 androidx.preference.EditTextPreference 中的 Title 和 EditText 颜色
- ajax - Thymeleaf:点击表格行提交表单
- flutter - Flutter:如何在 DatePicker 中仅启用特定日期的日期
- javascript - 如何从浏览器使用 Unleash Feature 服务器(React 项目)
- c++ - 关于在 main 中列出和声明函数的问题
- python - 如何按该行的数量从树视图中删除一行?
- postgresql - 将重复数据存储为 Postgres 中的列?
- c++ - 如何:将 C++14 模板函数扩展为可变参数模板、参数
- python - 有没有办法在 tkinter 中使用多手柄滑块?
- firebase - 检索文档列表,仅限于数组中的 ID——跟进