cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <p>SVG doesn't have a native shadow attribute/property like CSS's box-shadow or text-shadow, however shadows can still be acheived in a couple ways.</p>

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200px" height="200px" viewBox="0 0 200 200" version="1.1">
	
  <title>SVG Shadows</title>

  <defs>
    <filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="shadow-filter">
      <feOffset dx="0" dy="4" in="SourceAlpha" result="shadowOffsetOuter1"/>
      <feGaussianBlur stdDeviation="10" in="shadowOffsetOuter1" result="shadowBlurOuter1"/>
      <feColorMatrix values="0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.2 0" in="shadowBlurOuter1" type="matrix" result="shadowMatrixOuter1"/>
      <feMerge>
        <feMergeNode in="shadowMatrixOuter1"/>
        <feMergeNode in="SourceGraphic"/>
      </feMerge>
    </filter>
  </defs>
  
  <rect x="25" y="25" width="150" height="150" fill="#FFFFFF" filter="url(#shadow-filter)"/>
  
</svg>


<p>You could duplicate an element, change its color to black, drop the opacity, and blur it with a basic filter element. Or, you could use a more complex filter element to do all that for you. Fortunately, Sketch does the latter for you when you export a layer with a shadow, as shown here.<br><br>The markup looks complicated, but here's a breakdown: the feOffset element moves the shadow down 4px, the feGaussianBlur blurs it, the feColorMatrix makes it black and lowers the opacity, and feMergeNode combines the shadow with the element that the shadow belongs to. SVG filters are super powerful, but thankfully Sketch figures them out for you. Be careful to use them sparingly to prevent a performance bottleneck.</p>
            
          
!
            
              svg {
	display: block;
	margin: 40px auto;
}

body {
	padding-top: 60px;
}

p {
	font-family: Avenir, sans-serif;
	color: #404248;
	font-size: 16px;
	text-align: center;
	max-width: 700px;
	margin: 0 auto;
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console