- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
编辑 see this pen of Alexander Omara for a shorter version of my pen
基本上,我们将 bg
范围设置为始终超过全屏,即使在调整大小时也是如此。应该使用已知的“在图像周围使用比图像小的容器”来去除模糊边缘来去除模糊边缘。此容器具有实际屏幕视口(viewport)的大小。
现在这在最新的 firefox 35 中工作得很好。
但它在 webkit 浏览器中非常失败,例如在 chrome 40.0.2214.91 m 中测试。
首先,正文中可见绿色背景,在文本之后它消失了?!并显示出白色模糊。
这还不是全部,如果你使用水平滚动(实际上我真的不想要水平滚动)
body 的绿色背景消失。如果您再次向左滚动,它会重新出现。模糊边缘来自浏览器窗口的边缘,靠近滚动条,它不是来自实际图像边缘。可以看到绿色背景,当左右滚动时,绿色变成白色。
魔术。
拔掉这个插头,让我们的 webkit 社区修复它。还是我忽略了这个问题?
来源:
HTML
<span class="lux-section" ><span class="bg" ></span><span><br><br><br><br><br>About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us About us about us<br></span></span>
CSS
.lux-section .bg {
position: absolute;
width: 100%;
height: 100%;
background: url(http://s15.postimg.org/4elomwgbv/luxvitae.jpg) center center scroll no-repeat;
background-size: 100% auto;
-webkit-filter: blur(15px);
-moz-filter: blur(15px);
filter: blur(15px);
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
z-index: -1;
display: inline-block;
}
body{
background-color: green;
margin: 0;
}
JS
lux = {};
function reinitSizes(){
lux.viewWidth = $(window).width() ;
lux.viewHeight = $(window).height() ;
//enclosing span of the bg image and the text
$(".lux-section").css({
"width": lux.viewWidth,
"height": lux.viewHeight
});
//resize the bg image to be bigger than it's enclosing span.
$(".lux-section > .bg").each(function(index, bgObj){
var blur = 15;
var resized = blur * blur;
$(bgObj).css({
"width": (lux.viewWidth + resized),
"height": (lux.viewHeight + resized),
"top" : Math.round(-0.5*resized),
"left": Math.round(-0.5*resized)
});
});
}
$(function(){
reinitSizes();
$(window).resize(function() {
reinitSizes();
});
});
最佳答案
你可以试试这个技巧。
将您要模糊的相同图像应用到 div 容器
这里的例子:
http://codepen.io/anon/pen/aOoNGV
body {
background: black;
}
.wrap {
background: green;
width: 200px;
height: 200px;
position: relative;
overflow: hidden;
background: white url('https://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png');
}
.image {
position: absolute;
left: -15px;
right: -15px;
top: -15px;
bottom: -15px;
background: white url('https://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png');
-webkit-filter: blur(15px);
-moz-filter: blur(15px);
filter: blur(15px);
}
关于css - 与-webkit-filter : blur and not solid edges (works with filter: blur)战斗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28144996/
以下是有关战列舰及其参与的战斗的架构: Ships(name, yearLaunched, country, numGuns, gunSize, displacement) Battles(shi
我花了一个非常令人沮丧的晚上试图获得 wxpython在我的 MacBook Pro 上工作(运行 Snow Leopard 10.6.6)。通过阅读此处和其他网站上有关此主题的各种主题,这是我迄今为
这是一个关于战列舰和他们参加的战斗的模式: Ships(name, yearLaunched, country, numGuns, gunSize, displacement) Battles(s
您好,我正在尝试将 Jasper (4.0.2) 报告与 JBoss 6 一起使用,并使用 XML 文件作为数据源。然而,所需的库 JAR 存在相当多的重叠,并且由于我无法排除 JBoss 库,所以我
我有两个 相互重叠的元素,例如: ------------- | | | A | | | | ------------ |
我看过一些专门介绍 hasOwnProperty 的帖子,但我仍然质疑是否(以及何时)应该在简单的 obj.prop 上使用它 if (obj.hasOwnProperty("prop")) 对于检查
我正在为 Android 手机开发一个基于 Java 的回合制 RPG,目前我正在尝试弄清楚如何处理具有超出伤害的额外变量的攻击。例如,当目标具有燃烧效果时,我想让火焰攻击额外造成 10% 的伤害。我
我有一个它正在选择的怪物列表。 def monsters(): whatMonster = random.randint(0, 25) monster = pickMonste
一个多星期以来,我们一直在与 SurfaceViews 相关的一些问题作斗争,但没有找到合适的解决方案。我们阅读了论坛中关于类似问题(甚至 Mixare 源代码)的其他问题,但找不到答案,所以我们希望
我有一个顶部 div,它有 position: fixed。在 div 之后,我有一个菜单 div 也有 position: fixed,它将被定位为与顶部 div 重叠,因此它需要一个正确的 z-i
我正在尝试使用带 SSL 的 curl,但我收到有关证书的永久性错误。我知道 OSX 在 curl 证书方面一团糟,我想我在为开发人员创建自己的自签名证书(本地主机上的 node_ssl_server
I have written this pen 编辑 see this pen of Alexander Omara for a shorter version of my pen 基本上,我们将 b
我是一名优秀的程序员,十分优秀!