startv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource
via CSS Lint

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource
via JS Hint

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.

HTML

            
              <div class="module">
  <h3>Spacing the Bottom of Modules</h3>
  <p>Using pseudo elements <code>::before</code> and <code>::after</code> you can add consistent padding to an element without modifying children elements.</p>
  <p>In response to: <a href="http://css-tricks.com/spacing-the-bottom-of-modules/"><strong>CSS Tricks:</strong> Spacing the Bottom of Modules</a></p>
</div>

<div class="module">
  <p>Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum id ligula porta felis euismod semper. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec ullamcorper nulla non metus auctor fringilla.</p>
</div>

<div class="module">
  <img src="http://placehold.it/300" alt="Just a nice placeholder image" />
</div>

<div class="module">
  <p>Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum id ligula porta felis euismod semper. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Donec ullamcorper nulla non metus auctor fringilla.</p>
  <p>Etiam porta sem malesuada magna mollis euismod. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Donec sed odio dui. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec ullamcorper nulla non metus auctor fringilla. Cras justo odio, dapibus ac facilisis in, egestas eget quam.</p>
</div>
            
          
!

CSS

            
              @import "compass/css3";

// ----------------------------------------------------------
// So I heard you like to see the spacing in between elements
// ----------------------------------------------------------

:hover {
  outline: 1px solid rgba(red, 0.5);
  outline-offset: -1px;
}

// -------------------------
// Those sweet module styles
// -------------------------

.module {
  background: #eee;
  margin: 20px 0;
  padding: 0 20px;
  
  &::before,
  &::after {
    content: "";
    display: block;
    height: 1px;
  }
  
  &:before {
    margin-bottom: 19px;
  }
    
  &:after {
    margin-top: 19px;
  }
}

// -----------------------    
// A Wild Mixin Appears...
// -----------------------
    
@mixin module-padding($padding) {
  padding: 0 $padding;
  
  &::before,
  &::after {
    content: "";
    display: block;
    height: 1px;
  }
  
  &:before {
    margin-bottom: $padding - 1;
  }
    
  &:after {
    margin-top: $padding - 1;
  }
}

// -----------------------------------------    
// Just some typical everyday content styles
// -----------------------------------------

body {
  margin: 20px;
  font: normal 1em/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img {
  vertical-align: top;
  max-width: 100%;
  height: auto;
}
  
h3 {
  margin: 20px 0 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ccc;
}
            
          
!

JS

            
              
            
          
!
999px
Loading ..................

Console