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

              
                <h1>Adaptive design</h1>
<article>
  <p>When media queries arrived in CSS it opened the door to making layouts more flexible. But developers were still most comfortable making fixed-width layouts. One technique involved switching between a handful of fixed-width layouts at specified widths.</p>
  <p>This allowed designers to provide layouts that looked good at a few different sizes but the design never looked quite right when viewed <em>between</em> those sizes. The problem of excess space persisted although it wasn’t as bad as in a fixed-width layout.</p>
</article>
<aside>
  <p>Ultimately this technique wasn’t very popular. The term “adaptive” was also used to refer to other approaches so it can be a confusing descriptor for what was quite a niche technique.</p>
  <p>This example is using the CSS <code>float</code> property to create columns. That was a popular technique before CSS grid or flexbox existed.</p>
</aside>
              
            
!

CSS

              
                body {
  font-family: sans-serif;
  line-height: 1.5;
  padding: 0 16px;
}

h1 {
  margin-bottom: 0;
}

@media all and (min-width: 800px) {
  article {
    width: 540px;
    float: left;
  }
  
  aside {
    width: 250px;
    float: left;
    margin-left: 10px;
  }
}

@media all and (min-width: 1200px) {
  article {
    width: 800px;
    float: left;
  }
  
  aside {
    width: 350px;
    float: left;
    margin-left: 50px;
  }
}

@media all and (min-width: 1600px) {
  h1 {
    width: 400px;
    float: left;
  }
  
  article {
    width: 800px;
    float: left;
  }
  
  aside {
    width: 350px;
    float: left;
    margin-left: 50px;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console