[英]CSS blur and overflow:hidden
Update 更新
I have created a simliar jsfiddle here http://jsfiddle.net/ckaeno9s/ In safari this works correctly. 我在这里创建了一个simliar jsfiddle http://jsfiddle.net/ckaeno9s/在safari中这是正常的。 In chrome it does not.
在铬中它没有。 If you remove overflow:hidden;
如果你删除溢出:隐藏; from line 15 you'll notice that the blur is now being applied in the correct way.
从第15行开始,您会注意到模糊现在正以正确的方式应用。
This jsfiddle sums up the problem well. 这个问题很好地总结了这个问题。
Original Message 原始信息
I am trying to create a blurred banner effect and it is working pretty well in Safari (bottom) but not so well in Chrome (top). 我试图创建一个模糊的横幅效果,它在Safari(底部)工作得很好,但在Chrome(顶部)不太好。
How this is working is that something too big is being placed into a div in the header with a blur effect applied via -webkit-filter in the CSS, then the header has an overflow: hidden applied to it. 这是如何工作的是,通过-webkit-filter在CSS中应用模糊效果将标题放入标题中的div太大,然后标题有一个溢出:隐藏应用于它。 I think what is happening is the overflow: hidden is being applied before the blur in chrome, so then a smaller image is left to blur, giving the soft edges.
我认为发生的事情是溢出:隐藏在chrome中的模糊之前应用,因此较小的图像会留下模糊,给出柔和的边缘。 Whereas in Safari, the filter is being applied before the overflow: hidden.
而在Safari中,过滤器在溢出之前应用:隐藏。 If I increase the size of my div with overlow hidden I get the following:
如果我用overlow隐藏增加我的div的大小,我得到以下内容:
which is correct at the bottom of the header but obviously now it is flowing out of my header. 这在标题的底部是正确的,但显然现在它正在流出我的标题。 Is there any way I can get my overflow: hidden to be applied after the blur?
有什么方法可以让我的溢出:隐藏在模糊后应用? Or just achieve the same effect in chrome as I'm getting in safari.
或者只是在我的野生动物园中获得相同的效果。
.content-blurred {
margin-top:0px;
padding:0;
position:absolute;
top:-50px;
left:0;
right:0;
-webkit-filter:blur(10px);
-moz-filter: blur(10px);
-o-filter: blur(10px);
-ms-filter: blur(10px);
filter:url(#blur-effect);
opacity:1;
z-index: 1;
}
#header {
overflow:hidden;
position: fixed;
height:38px;
}
To summarise my question : I want to create hard edges on a blurred div. 总结一下我的问题 :我想在模糊的div上创建硬边。
Updated 更新
Something like this? 像这样的东西? http://jsfiddle.net/tbsksa18/1/
http://jsfiddle.net/tbsksa18/1/
<div class="parent">
<div class="miss-blurry"></div>
</div>
.parent{
width: 300px;
height: 300px;
margin: 100px;
position: relative;
overflow: hidden;
}
.miss-blurry{
width: 130%;
height: 130%;
position: absolute;
background: url(http://www.freeallimages.com/wp-content/uploads/2014/07/dog-1.jpg) center center;
background-size: cover;
-webkit-filter: blur(40px);
transform: translate(-15%, -15%);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.