Pen Settings

HTML

CSS

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

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

Auto Save

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

              
                    <div class="col one">     
      This example showcases use of (fake) vw unit. While things like width were already easy to tie to width of viewport, other properties, such as padding or font size or border radius were not. You should be able to see a couple of boxes with text, which are supposed to change font size, border width, border radius, and padding in response to viewport width changes.
    </div>
    <div class="col two">
        This example showcases use of (fake) vw unit. While things like width were already easy to tie to width of viewport, other properties, such as padding or font size or border radius were not. You should be able to see a couple of boxes with text, which are supposed to change font size, border width, border radius, and padding in response to viewport width changes.
    </div>
    <div class="col three">
        This column does not use the viewport width scaling, and so does not change (except in width) when the window is resized or device is rotated.
    </div>

              
            
!

CSS

              
                html { position: relative; }
body { font-size: 12px; font-family: sans-serif; margin: 0; padding: 0;}


.col { float: left; width: 33.3%; box-sizing: border-box; }
.col.one { background: #CFF; }
.col.two { background: #FFC; }
.col.three { background: #FCF; font-size: 20px; padding: 50px; }

.one, .two {

  border: solid #666;
  border-width: 10px; border-width: 0.01rem; /*1vw*/
  border-radius: 30px; border-radius: 0.03rem; /*3vw*/
  font-size: 20px; font-size: 0.02rem; /*2vw*/
  padding: 20px; padding: 0.02rem; /*2vw*/
}

              
            
!

JS

              
                (function (doc, win) {
    var docEl = doc.documentElement,
        recalc = function () {
            var clientWidth = docEl.clientWidth;
            if (!clientWidth) return;

            docEl.style.fontSize = clientWidth + 'px';
            docEl.style.display = "none";
            docEl.clientWidth; // Force relayout - important to new Androids
            docEl.style.display = "";
        };

    // Abort if browser does not support addEventListener
    if (!doc.addEventListener) return;

    // Test rem support
    var div = doc.createElement('div');
    div.setAttribute('style', 'font-size: 1rem');

    // Abort if browser does not recognize rem
    if (div.style.fontSize != "1rem") return;

    win.addEventListener('resize', recalc, false);
    doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);
              
            
!
999px

Console