Pen Settings



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


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


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.


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.


                <!-- See also: -->

<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');'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');'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');'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,{var m=document.createElement('a');'color:#0043eb;text-decoration:underline;',m.innerHTML=c,m.href='#',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 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>


                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) {
        var headers = document.querySelectorAll('h1,h2,h3,h4,h5,h6');
        if (headers.length) {
            var container = document.createElement('div');
   = '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');
   = '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) {

            var list = document.createElement('ol');
   = '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 ( {
                    var headerLink = document.createElement('a');
           = 'color:#0043eb;text-decoration:underline;';
                    headerLink.innerHTML = headerText;
                    headerLink.href = '#' +;
                } else {
                    listItem.innerHTML = listItem.innerHTML.concat(headerText);