Easy Tutorial
❮ Svg Text Svg Polyline ❯

SVG Shadow


Note: Internet Explorer and Safari do not support SVG filters!


<defs> and <filter>

All SVG filter definitions on the internet are contained within the <defs> element. The <defs> element is used for defining short elements with special elements (such as filters).

The <filter> tag is used to define SVG filters. The <filter> tag requires the id attribute to specify which filter to apply to the graphic.


SVG <feOffset>

Example 1

The <feOffset> element is used to create a shadow effect. The idea is to take an SVG graphic (image or element) and move it a bit on the xy plane.

The first example offsets a rectangle (with <feOffset>) and then blends the offset image on top (with <feBlend>):

Here is the SVG code:

Example

For Opera users: View SVG file (right-click on the SVG graphic to preview the source).

Code Analysis:


Example 2

Now, the offset image can be blurred (with <feGaussianBlur>):

Here is the SVG code:

Example

For Opera users: View SVG file (right-click on the SVG graphic to preview the source).

Code Analysis:


Example 3

Now, create a black shadow:

Here is the SVG code:

Example

For Opera users: View SVG file (right-click on the SVG graphic to preview the source).

Code Analysis:


Example 4

Now, color the shadow:

Here is the SVG code:

Example

For Opera users: View SVG file (right-click on the SVG graphic to preview the source).

Code Analysis:

❮ Svg Text Svg Polyline ❯