Create a shadow effect in SVG

A simple example of a shadow effect in SVG.
<!DOCTYPE html>
<html>
<body>

<svg height="140" width="140">
  <defs>
    <filter id="filter" x="0" y="0" width="200%" height="200%">
      <feOffset result="offOut" in="SourceAlpha" dx="20" dy="20" />
      <feGaussianBlur result="blurOut" in="offOut" stdDeviation="10" />
      <feBlend in="SourceGraphic" in2="blurOut" mode="normal" />
    </filter>
  </defs>
  <rect width="90" height="90" stroke="red" stroke-width="20" fill="blue" filter="url(#filter)" />
</svg>

</body>
</html>

Responses

0 Replies