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 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

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.

HTML

              
                <div class="wide">
  <h1>Wide</h1>
  <p>This div will maintain its aspect ratio.</p>
</div>

<div class="square">
  <h1>Square</h1>
  <p>This div will maintain its aspect ratio.</p>
</div>

<div class="tall">
  <h1>Tall</h1>
  <p>This div will maintain its aspect ratio.</p>
</div>
              
            
!

CSS

              
                .square {
  //width within the parent
  width: 100%;
  &:before {
    content: "";
    float: left;
    //essentially the aspect ratio. 100% means the
    //div will remain 100% as tall as it is wide, or
    //square in other words.
    padding-bottom: 100%;
  }
  //this is a clearfix. you can use whatever
  //clearfix you usually use, add
  //overflow:hidden to the parent element,
  //or simply float the parent container.
  &:after {
    content: "";
    display: table;
    clear: both;
  }
}

.wide {
  width: 100%;
  &:before {
    content: "";
    float: left;
    //this div will be only half as tall as it is wide
    padding-bottom: 50%;
  }
  &:after {
    content: "";
    display: table;
    clear: both;
  }
}

.tall {
  width: 50%;
  &:before {
    content: "";
    float: left;
    //this div will be twice as tall as it is wide
    padding-bottom: 200%;
  }
  &:after {
    content: "";
    display: table;
    clear: both;
  }
}

////////////////////////////////
// non demo related styling
*, *:before, *:after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  background-color: #20748e;
}
.square,
.tall,
.wide {
  padding: 1em;
  background: rgba(#214050,.5);
  box-shadow: 0 0 0 1px rgba(#214050,.2) inset;
  text-align: center;
  font-family: "Century Gothic", sans-serif;
  h1 {
    margin-bottom: 0;
    color: #fbfbcd;
  }
  p {
    margin: 0;
    color: #b9b097;
    font-style: italic;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console