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="font-size-control">Document font-size control: <input type="range" id="document-font-size-control" min="0.5" max="3.0" step="0.2" value="1.0">
</div>

<div class="page-wrap">

  <section class="main-content">

    <article class="module" data-font-size-in-rem="1.2">
      <h3>Title of Module</h3>
      <time>Aug 5, 2014</time>
      <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
      <footer>
        Some extra information.
      </footer>
    </article>

    <article class="module" data-font-size-in-rem="1.2">
      <h3>Title of Module</h3>
      <time>Aug 10, 2014</time>
      <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
      <footer>
        Some extra information.
      </footer>
    </article>

  </section>

  <aside>
    
    <div class="module" data-font-size-in-rem="0.9">
      <h3>Sidebar Thing</h3>
      <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam</p>
      <ul>
        <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
        <li>Aliquam tincidunt mauris eu risus.</li>
        <li>Vestibulum auctor dapibus neque.</li>
      </ul>  
    </div>
    
    <div class="module" data-font-size-in-rem="0.9">
      <h3>Sidebar Thing</h3>
      <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam</p>
      <ul>
        <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
        <li>Aliquam tincidunt mauris eu risus.</li>
        <li>Vestibulum auctor dapibus neque.</li>
      </ul>  
    </div>
    
  </aside>
  
  <footer class="module footer-module" data-font-size-in-rem="0.75">
    &copy;2014 Name of the Site and Stuff
  </footer>
  
</div>
              
            
!

CSS

              
                body {
  padding: 10px;
}

.page-wrap {
  display: flex;
  flex-wrap: wrap;
}
.main-content {
  width: 66.66%;
  padding-right: 10px;
}
aside {
  width: calc(33.33% - 10px);
}
.footer-module {
  font-size: 0.75rem;
  flex: 0 0 90%;
}

.module {
  border: 1px solid #ccc;
  background: #eee;
  padding: 20px;
  margin: 0 0 20px 0;
  position: relative;
  .module-control {
    margin: -20px -20px 10px -20px;
  }
}

.font-size-control {
  background: #E77E23;
  padding: 10px;
  margin: 0 0 10px 0;
  font-size: 12px;
  > * {
    vertical-align: middle;
  }
}

article {
  font-size: 1.2rem;
  > h3 {
    font-size: 1.5em;
    margin: 0 0 0.5em;
  }
  > time {
    font-size: 0.9em;
    color: #999;
    display: block;
  }
  > footer {
    border-top: 1px solid #ccc;
    padding-top: 0.5em;
    font-size: 0.8em; 
  }
}

aside .module {
  font-size: 0.9rem;
  > h3 {
    font-size: 1.4em;
    margin: 0 0 0.4em 0;
  }
}
              
            
!

JS

              
                $(".module").prepend("<div class='module-control font-size-control'>Module: <input type='range'></div>");

$("input[type='range']").each(function() {
  var el = $(this);
  el.attr("min", 0.5);
  el.attr("max", 3.0);
  el.attr("step", 0.2);
  el.attr("value", el.parent().data("font-size-in-rem"));
})
.on("change", function() {
  $(this).closest(".module").css("font-size", $(this).val() + "rem");
});

$("#document-font-size-control")
.on("change", function() {
  $("html").css("font-size", $(this).val() + "rem");
});

              
            
!
999px

Console