css - 如何跨浏览器模糊图像?

标签 css image firefox google-chrome blur

在 Chrome 中,下面的 CSS 模糊了图像。然而,当我在 firefox 中查看图像时,图像不再模糊。关于如何让它跨浏览器工作的任何建议?

div.wrapper{
    float:left; /* important */
    position:relative; /* important(so we can absolutely position the description div */ 
    padding: 5px;
}

div.imageblur{
    position: relative; 
    top: 0; 
    left: 0; 
    width: 320px; 
    filter: blur(5px);
       -webkit-filter: blur(5px);
       -moz-filter: blur(5px);
       -o-filter: blur(5px);
       -ms-filter: blur(5px);

   margin:-1px;
   padding:1px;
}

div.image_container{
   width:318px;
   overflow:hidden;
}

html

<div class="wrapper">

            <!-- image -->
            <div style="position: relative; left: 0; top: 0;">

                <div class="image_container">
                    <div class="imageblur">     
                        <a href="youtube/IiGW9JA_aPg"> <img src="http://i2.ytimg.com/vi/IiGW9JA_aPg/hqdefault.jpg"></a>
                    </div>
                </div>                  
            </div>
            <!-- end image div -->

</div>

最佳答案

Firefox 也支持过滤器,但语法略微复杂:这是我在 fiddle 上的示例:

img{
    filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 3.5+ */
    filter: grayscale(100%);
}

FILTER EXAMPLE

关于css - 如何跨浏览器模糊图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13495429/

相关文章:

html - 第一个单元格比其余单元格宽的表格

javascript - 使用 ruby​​ on rails 和 javascript 将 Canvas 转换为图像并在新窗口中打开

css - Google Earth 插件上的 iframe 在 Windows Firefox 中失败

python - RGB色彩校正

HTML BASE 在 Ubuntu 12.04 上的 FF 13 和 Chromium 18 中无法正常工作

javascript - firefox 使用 jQuery animate 方法和绝对位置的奇怪行为

html - Z-index 不适用于父项中的子项

html - Twitter Bootstrap3 问题

html - 防止滚动条将内容推送到左侧的纯 css 方法?

java - 图像图标未出现在 Eclipse 外部