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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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>Top</h2>
<div>
  <div class="space-wrap">
    <span class="box m-t-spacer-2xs"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-t-spacer-xs"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-t-spacer-sm"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-t-spacer-md"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-t-spacer-lg"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-t-spacer-xl"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-t-spacer-2xl"></span>
  </div>
</div>


<h2>Bottom</h2>
<div>
  <div class="space-wrap">
    <span class="box m-b-spacer-2xs"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-b-spacer-xs"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-b-spacer-sm"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-b-spacer-md"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-b-spacer-lg"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-b-spacer-xl"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-b-spacer-2xl"></span>
  </div>
</div>


<h2>Right</h2>
<div>
  <div class="space-wrap">
    <span class="box m-r-spacer-2xs"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-r-spacer-xs"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-r-spacer-sm"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-r-spacer-md"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-r-spacer-lg"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-r-spacer-xl"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-r-spacer-2xl"></span>
  </div>
</div>


<h2>Left</h2>
<div>
  <div class="space-wrap">
    <span class="box m-l-spacer-2xs"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-l-spacer-xs"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-l-spacer-sm"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-l-spacer-md"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-l-spacer-lg"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-l-spacer-xl"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-l-spacer-2xl"></span>
  </div>
</div>


<h2>Left + Right</h2>
<div>
  <div class="space-wrap">
    <span class="box m-x-spacer-2xs"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-x-spacer-xs"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-x-spacer-sm"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-x-spacer-md"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-x-spacer-lg"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-x-spacer-xl"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-x-spacer-2xl"></span>
  </div>
</div>


<h2>Top + Bottom</h2>
<div>
  <div class="space-wrap">
    <span class="box m-y-spacer-2xs"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-y-spacer-xs"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-y-spacer-sm"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-y-spacer-md"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-y-spacer-lg"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-y-spacer-xl"></span>
  </div>
  <div class="space-wrap">
    <span class="box m-y-spacer-2xl"></span>
  </div>
</div>

            
          
!
            
              // ----------------------------------------
// Absolute Horizontal and Vertical Spacing
// Ether used the core typeface to generate sizes for the system spacing.
// $cap is defined as the x-height of the $b0 type size
// ----------------------------------------

// Create spacing sizes tied to type

$cap: .9ex;     // Cap-height of the $b0 font size

$spacer-none: 0; // 0
$spacer-2xs: round($cap * .5); // 5px
$spacer-xs: $cap; // 9px
$spacer-sm: round($cap * 1.5);  // 14px
$spacer-md: round($cap * 2.5);  // 23px
$spacer-lg: round($cap * 4); // 36px
$spacer-xl: round($cap * 6.5); // 59px
$spacer-2xl: round($cap * 10.5); // 95px

$sizes: (
  none: $spacer-none,
  2xs: $spacer-2xs,
  xs: $spacer-xs,
  sm: $spacer-sm,
  md: $spacer-md,
  lg: $spacer-lg,
  xl: $spacer-xl,
  2xl: $spacer-2xl
);

// margin
@each $size, $value in $sizes {
  .m-t-spacer-#{$size} {
    margin-top: $value * .7;
    @media (min-width: 768px) {
      margin-top: $value;
    }
  }
  .m-b-spacer-#{$size} {
    margin-bottom: $value * .7;
    @media (min-width: 768px) {
      margin-bottom: $value;
    }
  }
  .m-l-spacer-#{$size} {
    margin-left: $value * .7;
    @media (min-width: 768px) {
      margin-left: $value;
    }
  }
  .m-r-spacer-#{$size} {
    margin-right: $value * .7;
    @media (min-width: 768px) {
      margin-right: $value;
    }
  }
  .m-x-spacer-#{$size} {
    margin-right: $value * .7;
    margin-left: $value * .7;
    @media (min-width: 768px) {
      margin-right: $value;
      margin-left: $value;
    }
  }
  .m-y-spacer-#{$size} {
    margin-top: $value * .7;
    margin-bottom: $value * .7;
    @media (min-width: 768px) {
      margin-top: $value;
      margin-bottom: $value;
    }
  }
}

// padding
@each $size, $value in $sizes {
  .p-t-spacer-#{$size} {
    padding-top: $value * .7;
    @media (min-width: 768px) {
      padding-top: $value * .7;
    }
  }
  .p-b-spacer-#{$size} {
    padding-bottom: $value * .7;
    @media (min-width: 768px) {
      padding-bottom: $value * .7;
    }
  }
  .p-l-spacer-#{$size} {
    padding-left: $value * .7;
    @media (min-width: 768px) {
      padding-left: $value * .7;
    }
  }
  .p-r-spacer-#{$size} {
    padding-right: $value * .7;
    @media (min-width: 768px) {
      padding-right: $value * .7;
    }
  }
  .p-x-spacer-#{$size} {
    padding-right: $value * .7;
    padding-left: $value * .7;
    @media (min-width: 768px) {
      padding-right: $value * .7;
      padding-left: $value * .7;
    }
  }
  .p-y-spacer-#{$size} {
    padding-top: $value * .7;
    padding-bottom: $value * .7;
    @media (min-width: 768px) {
      padding-top: $value * .7;
      padding-bottom: $value * .7;
    }
  }
}






// Mixins for the spacers.
// usage: @include m-t-spacer-($spacer-md);

@mixin m-t-spacer-($value) {
  margin-top: $value * .7;
  @media (min-width: 768px) {
    margin-top: $value;
  }
}
@mixin m-b-spacer-($value) {
  margin-bottom: $value * .7;
  @media (min-width: 768px) {
    margin-bottom: $value;
  }
}
@mixin m-l-spacer-($value) {
  margin-left: $value * .7;
  @media (min-width: 768px) {
    margin-left: $value;
  }
}
@mixin m-r-spacer-($value) {
  margin-right: $value * .7;
  @media (min-width: 768px) {
    margin-right: $value;
  }
}
@mixin m-x-spacer-($value) {
  margin-left: $value * .7;
  margin-right: $value * .7;
  @media (min-width: 768px) {
    margin-left: $value;
    margin-right: $value;
  }
}
@mixin m-y-spacer-($value) {
  margin-top: $value * .7;
  margin-bottom: $value * .7;
  @media (min-width: 768px) {
    margin-top: $value;
    margin-bottom: $value;
  }
}

@mixin p-t-spacer-($value) {
  padding-top: $value * .7;
  @media (min-width: 768px) {
    padding-top: $value;
  }
}
@mixin p-b-spacer-($value) {
  padding-bottom: $value * .7;
  @media (min-width: 768px) {
    padding-bottom: $value;
  }
}
@mixin p-l-spacer-($value) {
  padding-left: $value * .7;
  @media (min-width: 768px) {
    padding-left: $value;
  }
}
@mixin p-r-spacer-($value) {
  padding-right: $value * .7;
  @media (min-width: 768px) {
    padding-right: $value;
  }
}
@mixin p-x-spacer-($value) {
  padding-left: $value * .7;
  padding-right: $value * .7;
  @media (min-width: 768px) {
    padding-left: $value;
    padding-right: $value;
  }
}
@mixin p-y-spacer-($value) {
  padding-top: $value * .7;
  padding-bottom: $value * .7;
  @media (min-width: 768px) {
    padding-top: $value;
    padding-bottom: $value;
  }
}


// Codepen Specifics
.space-wrap {
  display: inline-block;
  background: pink;
}

.box {
  display: inline-block;
  float: left;
  background: #ccc;
  width: 50px;
  height: 50px;
}
body {
  font-family: Arial;
  padding: 50px;
}
            
          
!
999px
Loading ..................

Console