Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <svg style="border: 2px solid" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="300" height="300">
  <defs>
    <filter id="outlineEffect" x="-50%" y="-50%" width="200%" height="200%">
      <feMorphology id="outline-width" in="SourceAlpha" operator="dilate" radius="14" result="outlineWidth"/>
      <feMorphology id="padding-width" in="SourceAlpha" operator="dilate" radius="4" result="outlinePadding"/>
      <feComposite in="outlineWidth" in2="outlinePadding" operator="out" result="outline"/>
      <feFlood flood-color="black" result="color"/>
      <feComposite in="color" in2="outline" operator="in" result="outlineColor"/>
      <feMerge>
        <feMergeNode in="outlineColor"/>
        <feMergeNode in="SourceGraphic"/>
      </feMerge>
    </filter>
  </defs>
  <g filter="url(#outlineEffect)">
    <path fill="pink" stroke="#DA3D40" stroke-width="4" d="m150 189.599-39.088 20.552 7.462-43.526-31.619-30.828 43.701-6.349 19.544-39.599 19.544 39.599 43.701 6.349-31.619 30.828 7.462 43.526z"/>
  </g>
</svg>
<div>
  <label for="outline-width-input">Radius:</label>
  <input id="outline-width-input" name="outline-width-input" type="range" min="0" max="100" value="10" />
</div>
<div>
  <label for="outline-padding-input">Padding:</label>
  <input id="outline-padding-input" name="outline-width-input" type="range" min="0" max="20" value="4" />
</div>
              
            
!

CSS

              
                * {
  font-family: Arial
}

body {
  margin: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 30px;
}

div {
  display: flex;
  align-items: center
}

div > label {
  margin-right: 10px;
}

              
            
!

JS

              
                const outlineWidthInputElelement = document.querySelector('#outline-width-input');
const outlinePaddingInputElelement = document.querySelector('#outline-padding-input');

const outlineWidthElement = document.querySelector('#outline-width');
const paddingWidthElement = document.querySelector('#padding-width');

const getElementRadius = (element) => Number(element.getAttribute('radius'));

outlineWidthInputElelement.addEventListener('input', (e) => {
  outlineWidthElement.setAttribute('radius', getElementRadius(paddingWidthElement) + Number(e.target.value));
});

outlinePaddingInputElelement.addEventListener('input', (e) => {
  const lastPadding = getElementRadius(paddingWidthElement);
  paddingWidthElement.setAttribute('radius', Number(e.target.value));
  outlineWidthElement.setAttribute('radius', getElementRadius(outlineWidthElement) + Number(e.target.value) - lastPadding);
});

              
            
!
999px

Console