filter

<filter>

<filter>SVG元素用作原子滤波器操作的容器中。它永远不会被直接渲染。通过使用filter目标SVG元素上的属性或通过CSS属性来引用过滤器。filter

用法上下文

分类没有
允许的内容以任意顺序包含任意数量的以下元素:描述性元素过滤元素<animate>,<set>

属性

全局属性

  • Core attributes

  • Presentation attributes

  • XLink attributes

  • class

  • style

  • externalResourcesRequired

具体属性

  • x

  • y

  • width

  • height

  • filterRes

  • filterUnits

  • primitiveUnits

  • xlink:href

DOM接口

这个元素实现了SVGFilterElement接口。

SVG

<svg width="230" height="120" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <filter id="blurMe"> <feGaussianBlur in="SourceGraphic" stdDeviation="5"/> </filter> <circle cx="60" cy="60" r="50" fill="green" /> <circle cx="170" cy="60" r="50" fill="green" filter="url(#blurMe)" /> </svg>

结果

ScreenshotLive sample

产品规格

SpecificationStatusComment
Filter Effects Module Level 1The definition of '<filter>' in that specification.Working Draft
Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<filter>' in that specification.RecommendationInitial definition

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support1.0(Yes)4.0 (2.0)10.09.03.0

FeatureAndroidEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support(Yes)(Yes)4.0 (2.0)No support9.53.01