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.

            
              <!-- See also: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_HTML_sections_and_outlines -->

<div class="panel">
    <div id="test" class="test">
        <p>"Table of Contents" bookmarklet*</p>

        <p>Bookmark this: <a class="button" href="javascript:(function(){var e=document.querySelectorAll('h1,h2,h3,h4,h5,h6');if(e.length){var t=document.createElement('div');t.style='background-color:white;border:1px solid black;color:black;display:inline-block;font-size:16px;left:0;line-height:1.5;max-height:calc(100% - 1em);margin:0.5em;max-width:calc(100% - 1em);overflow-y:scroll;padding:0.5em 1.6em 0.5em 1em;position:fixed;top:0;z-index:9999;';var n=document.createElement('button');n.style='background-color:#eee;border:none;cursor:pointer;font-weight:700;line-height:1.8;padding:0 0.6em;position:absolute;right:0;top:0;',n.type='button',n.textContent='x',n.onclick=function(e){this.parentNode.remove()},t.appendChild(n);var i=document.createElement('ol');i.style='list-style-position:inside;list-style-type:disc;margin:0;padding:0;';for(var o=0,l=e.length;l>o;o++){var r=e[o],a=parseInt(r.tagName.substring(1,2)),d='&ndash;'.repeat(a),c=r.tagName+': '+r.textContent,p=document.createElement('li');if(p.innerHTML=d,r.id){var m=document.createElement('a');m.style='color:#0043eb;text-decoration:underline;',m.innerHTML=c,m.href='#'+r.id,p.appendChild(m)}else p.innerHTML=p.innerHTML.concat(c);i.appendChild(p)}t.appendChild(i),document.body.appendChild(t);}})();">ToC</a></p>
        
        <p><small>* Tested only in the latest stable version of Google Chrome for Mac on July 11 2016 (Version 51.0.2704.103 (64-bit)).</small></p>
    </div>
</div>
<div class="panel">
    <h1 id="header-1">Ornare Ultricies Condimentum Magna</h1>
    <h2 id="header-2">Sollicitudin Vehicula Fringilla Vestibulum</h2>
    <h3 id="header-3">Ligula Ornare Cursus</h3>
    <h2 id="">Elit Tellus Nullam Ornare Fusce</h2>
    <h3>Sit Quam Ultricies</h3>
    <h2>Ridiculus Fringilla Pharetra Magna</h2>
    <h3>Vestibulum Fusce Pharetra Ullamcorper Nullam</h3>
    <h5 id="header-5">Vehicula Tellus</h5>
    <h6 id="header-6">Aenean Fermentum Egestas Bibendum</h6>
    <h4>Venenatis Ipsum Cras Aenean</h4>
    <h2>Porta Fusce Etiam Ipsum</h2>
    <h3>Risus Dapibus Parturient Mattis Malesuada</h3>
    <h4 id="header-4">Tristique Consectetur Aenean</h4>
    <h3>Tortor Ornare Vulputate Adipiscing</h3>
    <h3>Aenean Fusce Venenatis Quam</h3>
    <h2>Aenean Porta Vestibulum Vehicula Mollis</h2>
    <h2>Cursus Ornare Sem</h2>
</div>
            
          
!
            
              body {
    font: 1em/1.45 sans-serif;
}

.panel {
    float: left;
    padding: 0.3em 0.6em;
    width: 40%;
}

.button {
    background-color: blue;
    border-radius: 0.2em;
    color: white;
    padding: 0.3em 0.6em;
}
            
          
!
            
              if (false) {
    javascript:(function(){
        var headers = document.querySelectorAll('h1,h2,h3,h4,h5,h6');
        if (headers.length) {
            var container = document.createElement('div');
            container.style = 'background-color:white;border:1px solid black;color:black;display:inline-block;font-size:16px;left:0;line-height:1.5;max-height:calc(100% - 1em);margin:0.5em;max-width:calc(100% - 1em);overflow-y:scroll;padding:0.5em 1.6em 0.5em 1em;position:fixed;top:0;z-index:9999;';

            var closeButton = document.createElement('button');
            closeButton.style = 'background-color:#eee;border:none;cursor:pointer;font-weight:700;line-height:1.8;padding:0 0.6em;position:absolute;right:0;top:0;';
            closeButton.type = 'button';
            closeButton.textContent = 'x';
            closeButton.onclick = function(event) {
                this.parentNode.remove();
            };
            container.appendChild(closeButton);

            var list = document.createElement('ol');
            list.style = 'list-style-position:inside;list-style-type:disc;margin:0;padding:0;';
            for (var i = 0, length = headers.length; i < length; i++) {
                var header = headers[i];
                var headersLevel = parseInt(header.tagName.substring(1, 2));
                var levelText = '&ndash;'.repeat(headersLevel);
                var headerText = header.tagName + ': ' + header.textContent;

                var listItem = document.createElement('li');
                listItem.innerHTML = levelText;
                if (header.id) {
                    var headerLink = document.createElement('a');
                    headerLink.style = 'color:#0043eb;text-decoration:underline;';
                    headerLink.innerHTML = headerText;
                    headerLink.href = '#' + header.id;
                    listItem.appendChild(headerLink);
                } else {
                    listItem.innerHTML = listItem.innerHTML.concat(headerText);
                }
                list.appendChild(listItem);
            }
            container.appendChild(list);
            document.body.appendChild(container);
        }
    })();
}
            
          
!
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