小编Mar*_*ckx的帖子

SVG过滤器仅在样式属性(Firefox)中添加时才起作用

我在HTML(text/html)中添加了一个模糊效果svg:

<html>
    <head>...</head>
    <body>
        ...
        <svg xmlns="http://www.w3.org/2000/svg" height="0">
            <filter height="116%" width="116%" y="-8%" x="-8%" id="svgBlur">
                 <feGaussianBlur stdDeviation="8" in="SourceGraphic"/>
            </filter>
        </svg>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

我在CSS表中引用的内容:

#page-container {
    filter: url("#svgBlur");
    -webkit-filter: blur(8px);
}
Run Code Online (Sandbox Code Playgroud)

这样做会使#page-container显示为白色(FF无法识别SVG过滤器).


时髦的部分:

当我在Firebug中禁用上面的过滤规则并在#page-container的style属性中读取它时,它就像一个魅力.

<div id="page-container" style="filter: url("#svgBlur");">
Run Code Online (Sandbox Code Playgroud)

我在监督什么?


响应标头:

Cache-Control   no-cache, must-revalidate, post-check=0, pre-check=0
Connection  Keep-Alive
Content-Encoding    gzip
Content-Language    nl
Content-Length  6098
Content-Type    text/html; charset=utf-8
Date    Mon, 02 Dec 2013 14:47:01 GMT
Etag    "1385995621"
Expires Sun, 19 Nov 1978 05:00:00 GMT
Keep-Alive  timeout=15, max=100
Last-Modified   Mon, 02 Dec 2013 14:47:01 …
Run Code Online (Sandbox Code Playgroud)

html css firefox svg svg-filters

16
推荐指数
2
解决办法
9234
查看次数

标签 统计

css ×1

firefox ×1

html ×1

svg ×1

svg-filters ×1