<feFlood>

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

<feFlood> SVG 滤镜原语使用由 flood-colorflood-opacity 定义的颜色和透明度填充滤镜子区域。

使用上下文

类别滤镜元素
允许的内容任意数量、任意顺序的下列元素:
<animate><set>

属性

DOM 接口

该元素实现了 SVGFEFloodElement 接口。

示例

HTML

html
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200">
  <defs>
    <filter id="floodFilter" filterUnits="userSpaceOnUse">
      <feFlood
        x="50"
        y="50"
        width="100"
        height="100"
        flood-color="green"
        flood-opacity="0.5" />
    </filter>
  </defs>

  <use style="filter: url(#floodFilter);" />
</svg>

结果

规范

Specification
Filter Effects Module Level 1
# feFloodElement

浏览器兼容性

BCD tables only load in the browser

参见