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="module">
  <p>
    This box doesn't have a width nor height. It should behave like any other block level element. 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>
  <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>
  <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>
</div>
<div class="module module2">
  This box is inline block.
</div>
<div class="module">
    This is a block element.
</div>
<div class="module">
    This is a block element also, as you see there's margin collapsing exactly as should.
</div>
              
            
!

CSS

              
                @import "compass/css3";

$color-gray: #aaa;

// The candy starts here, all values are mandatory
.module {
  background: $color-gray;
  position: relative;
  margin: 30px 0;
  padding: 0 20px;
}
.module:before,
.module:after {
  box-sizing: border-box;
  border-style: solid;
  border-color: transparent;
  border-width: 20px;
  content: "";
  display: block;
  left: 0;
  position: absolute;
  width: 100%;
}
.module:before {
  border-top-width: 0;
  border-bottom-color: $color-gray;
  top: -20px;
}
.module:after {
  border-bottom-width: 0;
  border-top-color: $color-gray;
  bottom: -20px;
}
// End the candy

.module2 {
  display: inline-block;
}

// Reset / Styling
body {
  background: url(http://hilja.net/i/tree_bark.png);
  padding: 20px;
}
p {
  margin: 0 0 20px 0;
  &:last-child {
    margin: 0;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console