css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <!--
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>
            
          
!
            
              /**
    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;
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console