Html 如何在背景图像的特定区域设置模糊效果?
我有一个有背景图像的div。在div内部,有一个以文本为中心的div。为了使文本更易于阅读,我想模糊这个特定区域中父div的背景图像 我想在text div上使用background filter:blur,但意识到firefox还不支持它 .家长{ 背景:url。。。; 宽度:100%; 高度:100vh; 显示器:flex; 证明内容:中心; 对齐项目:居中; } .孩子{ 宽度:300px; 高度:300px; 背景过滤器:blur10px——不幸的是firefox不支持 } 乱数假文Html 如何在背景图像的特定区域设置模糊效果?,html,css,Html,Css,我有一个有背景图像的div。在div内部,有一个以文本为中心的div。为了使文本更易于阅读,我想模糊这个特定区域中父div的背景图像 我想在text div上使用background filter:blur,但意识到firefox还不支持它 .家长{ 背景:url。。。; 宽度:100%; 高度:100vh; 显示器:flex; 证明内容:中心; 对齐项目:居中; } .孩子{ 宽度:300px; 高度:300px; 背景过滤器:blur10px——不幸的是firefox不支持 } 乱数假文
这比背景过滤器更好 css
背景滤镜几乎不受支持,只有but滤镜:blur10px;变得更受支持 你可以尝试另一种选择,使用滤镜和背景附加来创建两个相互重叠的片段,一个较小的片段被模糊 例如: 身体{ 背景:urlhttps://placeimg.com/640/480/tech; 背景附件:固定; /*准备要添加的模糊部分*/ 背景尺寸:100vw汽车; 保证金:0; 最小高度:100vh; 显示器:flex; } p:以前{ 内容:; 位置:绝对位置; 排名:0; 左:0; 身高:100%; 宽度:100%; z指数:-1; 过滤器:blur10px; 背景:urlhttps://placeimg.com/640/480/tech; 背景附件:固定; 背景尺寸:100vw汽车; } p{ 保证金:自动; 填充:20vh 10vh; /*背景:白色;如果需要*/ 位置:相对位置; z指数:1; 字体大小:calc10px+2vw; 边框:实心1px; 边界半径:1米; 溢出:隐藏; 盒影:2px 2px 2px }
这是做这项工作的替代方案吗 你想让文本的图像模糊效果可见吗?是的,只在文本位于@Manikandan2811的地方模糊图像
.parent{
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
.child{
color:#fff;
}
body, html {
height: 100%;
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
* {
box-sizing: border-box;
}
.parent {
/* The image used */
background-image: url("photographer.jpg");
/* Add the blur effect */
filter: blur(8px);
-webkit-filter: blur(8px);
height: 100%;
background-position: cente`enter code here`r;
background-repeat: no-repeat;
background-size: cover;
}
.child {
background-color: rgb(0,0,0);`enter code here`
background-color: rgba(0,0,0, 0.4);
color: white;
font-weight: bold;
border: 3px solid #f1f1f1;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 2;
width: 80%;
padding: 20px;
text-align: center;
}