<feDropShadow>
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.
SVG <feDropShadow>
原语创建输入图像的阴影。它只能在 <filter>
元素内使用
备注:
可以使用 flood-color
和 flood-opacity
表现属性来改变阴影的颜色和不透明度。
示例
html
<svg viewBox="0 0 30 10" xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="shadow">
<feDropShadow dx="0.2" dy="0.4" stdDeviation="0.2" />
</filter>
<filter id="shadow2">
<feDropShadow dx="0" dy="0" stdDeviation="0.5" flood-color="cyan" />
</filter>
<filter id="shadow3">
<feDropShadow
dx="-0.8"
dy="-0.8"
stdDeviation="0"
flood-color="pink"
flood-opacity="0.5" />
</filter>
</defs>
<circle cx="5" cy="50%" r="4" style="fill:pink; filter:url(#shadow);" />
<circle cx="15" cy="50%" r="4" style="fill:pink; filter:url(#shadow2);" />
<circle cx="25" cy="50%" r="4" style="fill:pink; filter:url(#shadow3);" />
</svg>
属性
使用上下文
规范
Specification |
---|
Filter Effects Module Level 1 # feDropShadowElement |
浏览器兼容性
BCD tables only load in the browser