<filter>

**<filter>** SVG 元素透過對原子濾波器基元進行分組來定義自定義濾波器效應。它本身從不渲染,但必須透過 SVG 元素上的 filter 屬性,或用於 SVG/HTML 元素的 filter CSS 屬性來使用。

使用環境

類別
允許的內容以下任何數量的元素,按任何順序
描述性元素
濾波器基元元素
<animate>, <set>

屬性

DOM 介面

此元素實現 SVGFilterElement 介面。

示例

SVG

html
<svg width="230" height="120" xmlns="http://www.w3.org/2000/svg">
  <filter id="blurMe">
    <feGaussianBlur 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>

結果

規範

規範
濾波器效應模組級別 1
# FilterElement

瀏覽器相容性

BCD 表格僅在瀏覽器中載入

另請參見