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

              
                <p class="all">EVERYTHING</p>
<p class="no-margin">NO BOTTOM MARGIN</p>
<p class="no-line-height">NO LINE HEIGHT</p>
<p class="define-line-height">CUSTOM LINE HEIGHT</p>
<p class="define-margin-bottom">CUSTOM BOTTOM MARGIN</p>
<p class="define-all">CUSTOM BOTTOM MARGIN, CUSTOM LINE HEIGHT</p>

<a class="all" href="http://alwaystwisted.com/post.php?s=2013-12-30-not-your-average-vertical-rhythm-sass-mixin">I wrote this up in a blog post</a>
              
            
!

CSS

              
                @import "compass/css3";

/* 

  Vertical Rhythm Mixin

    This mixin is to help create a typograhpical baseline grid but also to allow for specifying different line heights or bottom margins if you need to.

    In this mixin you can specifiy the font size in PX and it will calculate the REM based on your $doc-font-size & $doc-line-height variables. 

      @include font-size(24);

    It will also create a bottom margin based on the $doc-font-size & $doc-line-height variables unless you specify that it shouldn't have one -

      @include font-size(24, no);

    Or if you want to specify a different bottom margin to be generated -

      @include font-size(24,32);

    This mixin also generates a pixel-less line height by default unless you specify that you either don't want one where I'd suggest declaring 1 within the mixin -

      @include font-size(24, yes, 1);

    There's also the option to specify a different line-height for it to generate to, where you would specify the line-height in (effectively) it's pixel value -

      @include font-size(24, yes, 40);

*/

// this is the default font-size you want for the project
/////////////////////////////////////////////////////////

  $doc-font-size: 16;

// this is the default line-height you want for the project
///////////////////////////////////////////////////////////

  $doc-line-height: 24;

// the magic mixin
//////////////////

  @mixin font-size($size, $margin: yes, $line-height: $doc-line-height) {
    
      // generates the font-size in REMs with a PX fallback
      font-size: 0px + $size;
      font-size: 0rem + $size / $doc-font-size;
    
      // line-height functions
      ////////////////////////
    
      // if you a line-height is specified in the mixin
      @if $line-height != $doc-line-height and $line-height != 1 {
        line-height: ceil($size / $line-height) * ($line-height / $size);
      }
      
      // if $line-height == 1
      // because, typing 1 is quicker than 16
      @else if $line-height == 1 {
        line-height: 1;
      }
    
      // normal $line-height
      // if the line-height is left.
      @else {
        line-height: ceil($size / $doc-line-height) * ($doc-line-height / $size);
      }
    
      // margin-bottom functions
      //////////////////////////
    
      // if no is bottom margin is required
      @if $margin == no {
        margin-bottom: 0;  
      }  
      
      // if a specific bottom margin is required
      @else if $margin != yes and $margin != no {
        margin-bottom: 0px + $margin;
        margin-bottom: 0rem + ($margin / $doc-font-size);  
      }
    
      // if you're keeping the vertical rhythm with the margin
      @else {
        margin-bottom: 0px + $doc-line-height;
        margin-bottom: 0rem + ($doc-line-height / $doc-font-size);  
      }
  }


.all { @include font-size(14); }
.no-margin { @include font-size(16, no); }
.no-line-height { @include font-size(16, yes, 1); }
.define-line-height { @include font-size(16, yes, 48); }
.define-margin-bottom { @include font-size(16, 48); }
.define-all { @include font-size(16, 48, 48); }
              
            
!

JS

              
                
              
            
!
999px

Console