Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

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.

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

              
                <!--
This is an SVG sprite container with a single SVG icon inside.
-->
<svg style="display: none">
    <symbol id="icon-angle-down"
            height="24"
            width="24"
            viewBox="0 0 24 24">
        <path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/>
        <path fill="none" d="M0 0h24v24H0V0z"/>
    </symbol>
</svg>

<h1>An SVG Icon</h1>

<p>This is a demonstration of having the same SVG icon but in one instance it is unoptimized and in the other it is run through <a href="https://jakearchibald.github.io/svgomg">SVGOMG</a>. The third instance is a reference to an SVG inside an inline sprite.</p>

<p>Look at the HTML editor above to see the underlying code.</p>

<h2>The unoptimized SVG</h2>

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve" class="svg-icon">
    <path d="M7.41,8.59L12,13.17l4.59-4.58L18,10l-6,6l-6-6L7.41,8.59z"/>
    <path fill="none" d="M0,0h24v24H0V0z"/>
</svg>

<h2>The minified and optimized SVG</h2>

<svg class="svg-icon" viewBox="0 0 24 24"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"/><path fill="none" d="M0 0h24v24H0V0z"/></svg>

<h2>Referencing the SVG from a sprite</h2>

<svg class="svg-icon">
    <use xlink:href="#icon-angle-down" />
</svg>
              
            
!

CSS

              
                /**
    Note that all these styles are just examplatory.
**/
body {
    font-family: sans-serif;
    line-height: 1.5;
    text-align: center;
    box-sizing: border-box;
    margin: 2em auto;
    max-width: 35em;
    color: #2b2b2b;
    background: #fafafa;
    
    * {
        box-sizing: border-box;
    }
}

p {
    font-size: 1.125em;
    margin: 0;
    
    + p {
        margin-top: 1.5em;
    }
}

a {
    color: cornflowerblue;
    transition: color .3s;
    
    &:visited {
        color: rebeccapurple;
    }
    
    &:hover,
    &:focus {
        color: blue;
    }
    
    &:active {
        color: firebrick;
    }
}

.svg-icon {
    /* Place the icon on the text baseline. */
    position: relative;
    top: .125em;

    /* Prevent the icon from shrinking inside a flex container. */
    flex-shrink: 0;

    /* Scale the icon to match the font-size of the parent element. */
    height: 2em;
    width: 2em;

    /* Let the icon take whatever color the parent has. */
    fill: currentColor;

    /*
     * If the icon is used on a link, which has a color transition,
     * we can also use a transition on the fill value.
    */
   transition: fill .3s;
}
              
            
!

JS

              
                
              
            
!
999px

Console