cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              <h2>The following margins will collapse because...</h2>
<p>"In CSS, the adjoining margins of two or more boxes (which might or might not be siblings) can combine to form a single margin. Margins that combine this way are said to collapse, and the resulting combined margin is called a collapsed margin."<br />http://www.w3.org/TR/CSS2/box.html#collapsing-margins</p>

<div class="item">
  Collapsed margin
</div>
<div class="item">
  Collapsed margin
</div>
<div class="item">
  Collapsed margin
</div>
  
<h2>The following margins will collapse because...</h2>
<p>If there is no border, padding, inline content, or clearance to separate the margin-top of a block with the margin-top of its first child block, or no border, padding, inline content, height, min-height, or max-height to separate the margin-bottom of a block with the margin-bottom of its last child, then those margins collapse. <b>The collapsed margin ends up outside the parent.</b><br />
https://developer.mozilla.org/en-US/docs/CSS/margin_collapsing</p>
<div class="parent">
  <div class="item">
    Collapsed margin
  </div>
  <div class="item">
    Collapsed margin
  </div>
</div>
<div class="parent">
  <div class="item">
    Collapsed margin
  </div>
  <div class="item">
    Collapsed margin
  </div>
</div>

<h2>The following margins won't collapse because...</h2>
<p>There <b>is a</b> border, padding, inline content, or clearance to separate the margin-top of a block with the margin-top of its first child block, or a border, padding, inline content, height, min-height, or max-height to separate the margin-bottom of a block with the margin-bottom of its last child, then those margins collapse. The collapsed margin ends up outside the parent.<br />
https://developer.mozilla.org/en-US/docs/CSS/margin_collapsing</p>

<div class="parent daddy">
  <div class="item">
    Margin
  </div>
  <div class="item">
    Margin
  </div>
</div>
<div class="parent daddy">
  <div class="item">
    Margin
  </div>
  <div class="item">
    Margin
  </div>
</div>
            
          
!
            
              .item{margin: 20px 0; background: #ccc;}
.parent{background: #aaa;}
.daddy{border: solid 1px red;}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console