Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/web/svg/element/fedropshadow/index.md
6581 views
---
title: <feDropShadow> slug: Web/SVG/Element/feDropShadow page-type: svg-element tags: - Element - Filters - Reference - SVG browser-compat: svg.elements.feDropShadow
---

{{SVGRef}}

The SVG <feDropShadow> filter primitive creates a drop shadow of the input image. It can only be used inside a {{SVGElement('filter')}} element.

Note: The drop shadow color and opacity can be changed by using the {{SVGAttr('flood-color')}} and {{SVGAttr('flood-opacity')}} presentation attributes.

Example

html, body, svg { height: 100%; }
<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>

{{EmbedLiveSample('Example', 150, '100%')}}

Attributes

  • {{SVGAttr("dx")}}

    • : This attribute defines the x offset of the drop shadow. Value type: <number>; Default value: 2; Animatable: yes

  • {{SVGAttr("dy")}}

    • : This attribute defines the y offset of the drop shadow. Value type: <number>; Default value: 2; Animatable: yes

  • {{SVGAttr("stdDeviation")}}

    • : This attribute defines the standard deviation for the blur operation in the drop shadow. Value type: <number>; Default value: 2; Animatable: yes

Global attributes

Usage notes

{{svginfo}}

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}