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.

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="parent">
  <div class="child"></div>
   <div class="child right"></div>
</div>

<p>This is what happens when you add a margin to a perfectly floated pair of child elements within a parent element and do not subtract those margins from the width of the item.</p>

<div class="parent-b">
  <div class="child-b no-float"></div>
   <div class="child-b no-float"></div>
</div>

<section class="bottom-parent">

<p>This is what happens when you add a margin to a perfectly floated pair of child elements within a parent element AND properly subtract those margins from the width of the child items so that everything floats.</p>

<div class="parent-b">
  <div class="child-b"></div>
   <div class="child-b"></div>
</div>
  
</section>
              
            
!

CSS

              
                body{
  background-color: #DAEDED;
}

p{
  width: 800px;
  text-align: center;
  margin: 0 auto;
}

.parent{
  background-color: #2D4EA6;
  width: 800px;
  height: 300px;
  margin: 75px auto;
}

.child{
  background-color: #E3D184;
  width: 396px;
  height: 200px;
  margin: 50px 0;
  float: left;
  border: 2px white solid; /* border added to show difference between two divs */
}

.parent-b{
  background-color: #00BBB8;
  width: 800px;
  height: 300px;
  margin: 75px auto;
}

.child-b{
  background-color: #ABFFE3;
  width: 350px; /*since there is a margin of 25px on each side of the child-b divs, those margins must be subtracted from the widht of each itme */
  height: 200px;
  margin: 50px 25px; 
  float: left;
}

.no-float{
  width: 400px;
}

.bottom-parent{
clear: both; /* moving this out of the way of the two divs above */
}
              
            
!

JS

              
                
              
            
!
999px

Console