[英]How to Blur just one part of a div CSS
I am adding a section/block to my website. 我正在向我的网站添加版块/块。 The font overlay does not look good with all background pictures.
字体覆盖在所有背景图片上看起来都不太好。 Sometimes it is hard to read the text.
有时很难阅读文字。 A slight blur will fix my issue.
轻微的模糊会解决我的问题。 However, with my current code and all the variations I have tried, it applies to blur way above the text size.
但是,使用我当前的代码和我尝试过的所有变体,它都适用于超出文本大小的模糊方式。 If I apply blur to just the text areas it does not make a perfect "square" and leaves the empty areas the original background color.
如果仅对文本区域应用模糊处理,则不会形成完美的“正方形”,而将空白区域保留为原始背景色。 Sort of a highlighter effect.
某种荧光笔效果。
How do I make it so that it blurs only the box of text as a whole? 我如何使它仅模糊整个文本框? I have been trying to get something that looks like what this guy has done: https://jordanhollinger.com/2014/01/29/css-gaussian-blur-behind-a-translucent-box/
我一直在尝试获得看起来像这个人所做的事情: https : //jordanhollinger.com/2014/01/29/css-gaussian-blur-behind-a-translucent-box/
My CSS code is: 我的CSS代码是:
* {
box-sizing: border-box;
}
beody {
margin: 0;
font-weight: 500;
font-family: 'HelveticaNeue';
}
esction {
width: 100%;
padding: 0 7%;
display: table;
margin: 0;
max-width: none;
background-color: #373B44;
height: 100vh;
background-image:url("https://s15.postimg.cc/999tzxuqz/test_banner.jpg");
background-repeat:no-repeat;
background-size:cover;}
section:nth-of-type(2n) {
background-color: #FE4B74;
background-image:url("https://images.pexels.com/photos/248797/pexels-photo-248797.jpeg?auto=compress&cs=tinysrgb&h=350");
}
}
.einto {
height: 50vh;
}
.econten {
display: table-cell;
vertical-align: middle;
background: rgb(34,34,34); /* for IE */
background: rgba(34,34,34,0.75);
}
eh1 {
font-size: 3em;
display: block;
color: white;
font-weight: 300;
}
ep {
font-size: 1.5em;
font-weight: 500;
color: #C3CAD9;
}
ea {
font-weight: 700;
color: #373B44;
position: relative;
e&:hover{
opacity: 0.8;
}
Here is what is happening when I apply it as is: https://postimg.cc/image/471owh7w7/ 这是我按原样应用时发生的情况: https : //postimg.cc/image/471owh7w7/
Your black <div>
should have position: absolute
, and you should in style use blur for it. 黑色的
<div>
应该具有position: absolute
,并且在样式上应使用模糊处理。
Inside that <div>
will be another <div>
with your text (content) and it should have position: relative
and with a z-index
that has a greater value than the black <div>
. 在该
<div>
内部将是另一个<div>
其中包含您的文本(内容),并且应该具有position: relative
,并且z-index
值比黑色<div>
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.