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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

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.

HTML

            
              <style>
/* jslint utility2:true */
/*csslint
    box-model:false,
    ids:false,
*/
/* csslint ignore:start */
*,
*:after,
*:before {
    box-sizing: border-box;
}
/* csslint ignore:end */
body {
    background: #eee;
    display: flex;
    flex-flow: column;
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    padding: 10px;
}
body > div {
    background: #fff;
    border: 1px solid #ddd;
    margin-top: 10px;
    padding: 10px;
}
body > div:first-child {
    margin-top: 0;
}
#panelBody1 {
    border: 0;
    display: flex;
    flex: 1;
    padding: 0;
}
#panelBody1 > div {
    border: 1px solid #ddd;
    padding: 10px;
}
#panelBody1 > #borderResize1 {
    background: #fbb;
    border: 0;
    cursor: ew-resize;
    padding: 5px;
}
</style>

<div id="header1">
    #header1 - drag
    <span style="background: #fbb; padding: 2px;">red-bar</span>
    between #panelSidebar1 and #panelSidebar2 to resize
</div>
<div id="panelBody1">
    <div id="panelSidebar1">#panelSidebar1 (width: <span>0</span>px)</div>
    <div id="borderResize1"></div>
    <div id="panelContent1" style="flex: 1;">
        #panelContent1 (width: <span>0</span>px)
    </div>
</div>
<div id="footer1">#footer1</div>

<script>
/* jslint utility2:true */
(function () {
    "use strict";
    var local;
    local = {};

    // init event-handling - resize panel
    local.domOnEventDrag = function (event) {
    /*
     * this function will handle <event> to drag-and-drop
     */
        switch (Boolean(local.domOnEventDragEvent) + "." + event.type) {
        case "false.mousedown":
            local.domOnEventDragEvent = event;
            return;
        case "true.mouseenter":
        case "true.mouseup":
            local.domOnEventDragEvent = null;
            return;
        case "true.mousemove":
            switch (local.domOnEventDragEvent.target.id) {
            case "borderResize1":
                event.preventDefault();
                event.stopPropagation();
                document.querySelector(
                    "#panelContent1"
                ).style.width = "0";
                document.querySelector(
                    "#panelSidebar1"
                ).style.width = event.x + "px";
                local.domOnEventWindowResize();
                // display resize-info
                document.querySelectorAll(
                    "#panelContent1 span, #panelSidebar1 span"
                ).forEach(function (elem) {
                    elem.textContent = elem.parentElement.offsetWidth;
                });
                return;
            }
            return;
        }
    };
    Array.from(document.querySelectorAll(
        "#borderResize1"
    )).forEach(function (elem) {
        elem.addEventListener("mousedown", local.domOnEventDrag);
    });
    document.addEventListener("mouseenter", local.domOnEventDrag);
    document.body.addEventListener("mousemove", local.domOnEventDrag);
    document.body.addEventListener("mouseup", local.domOnEventDrag);

    // init event-handling - resize window
    local.domOnEventWindowResize = function () {
    /*
     * this function will handle <event> to resize window
     */
        // resize body
        document.body.style.height = window.innerHeight + "px";
        // resize - #panelBody1 > div
        document.querySelectorAll(
            "#panelBody1 > div"
        ).forEach(function (elem) {
            elem.height = elem.parentElement.clienthHeight + "px";
        });
        // display resize-info
        document.querySelectorAll(
            "#panelContent1 span, #panelSidebar1 span"
        ).forEach(function (elem) {
            elem.textContent = elem.parentElement.offsetWidth;
        });
    };
    window.addEventListener("resize", local.domOnEventWindowResize);
    local.domOnEventWindowResize();
}());
</script>

            
          
!

CSS

            
              
            
          
!

JS

            
              
            
          
!
999px

Console