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

              
                <div class="wrapper">
  <article class="price-block">
    <header class="price-block__header">
      <h1 class="price-block__title">Basic Plan</h1>
      <span class="price-block__cost">Free</span>
      <span class="price-block__trigger">▾</span>
    </header>
    <div class="price-block__info">
      <button class="price-block__btn">Sign Up</button>
      <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>
  </article>

  <article class="price-block">
    <header class="price-block__header">
      <h1 class="price-block__title">Standard Plan</h1>
      <span class="price-block__cost">$10 per month</span>
      <span class="price-block__trigger">▾</span>
    </header>
    <div class="price-block__info">
      <button class="price-block__btn">Sign Up</button>
      <p>They're pretty neat huh?</p>
    </div>
  </article>

  <article class="price-block">
    <header class="price-block__header">
      <h1 class="price-block__title">Premium Plan</h1>
      <span class="price-block__cost">$20 per month</span>
      <span class="price-block__trigger">▾</span>
    </header>
    <div class="price-block__info">
      <button class="price-block__btn">Sign Up</button>
      <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>
  </article>

  <article class="price-block">
    <header class="price-block__header">
      <h1 class="price-block__title">Advanced Plan</h1>
      <span class="price-block__cost">First Born Child</span>
      <span class="price-block__trigger">▾</span>
    </header>
    <div class="price-block__info">
      <button class="price-block__btn">Sign Up</button>
      <p>It's only your first born child! What are you waiting for! No biggie right? Signup now!</p>
    </div>
  </article>
</div>
              
            
!

CSS

              
                @import "compass/css3";

// ============================================================
// $Price Block Variables
// ============================================================

$width: 25%;
$viewport-increment: 0.1px;
$price-block-large: 740px;
$collapsed-price-block: $price-block-large - $viewport-increment;
$price-block-bg: #0D3640;
$price-block-color: #EFEFEF;


// ============================================================
// $Globals
// ============================================================

*,
:before,
:after {
  box-sizing: border-box;
}

html {
  font: normal 100%/1.5 sans-serif;
  word-wrap: break-word;
}

html,
body {
  height: 100%;
}

:before,
:after {
  content: "";
  height: 100%;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: -1;
}


// ============================================================
// $Container
// ============================================================

.wrapper {
  overflow: auto;
  height: 100%;
  position: relative;
}


// ============================================================
// $Price Block
// ============================================================

.price-block {
  padding: 0 1rem; // 0 (16px/16px)
  font-family: 'Open Sans', sans-serif;
  font-weight: 400;
  font-size: 1rem;
  color: $price-block-color;

  @media screen and (max-width: $collapsed-price-block) {
    position: relative;
  }

  @media screen and (min-width: $price-block-large) {
    float: left;
  }

  &:nth-child(1) {
    background: $price-block-bg;
    @media screen and (min-width: $price-block-large) {
      width: $width;
    }

    &:before {
      @media screen and (min-width: $price-block-large) {
        left: 0;
        width: $width;
        background: $price-block-bg;
      }
    }
  }

  &:nth-child(2) {
    background: scale-lightness($price-block-bg, 5%);
    @media screen and (min-width: $price-block-large) {
      width: $width;
    }

    &:before {
      @media screen and (min-width: $price-block-large) {
        left: $width;
        width: $width;
        background: scale-lightness($price-block-bg, 5%);
      }
    }
  }

  &:nth-child(3) {
    background: scale-lightness($price-block-bg,10%);

    @media screen and (min-width: $price-block-large) {
      width: $width;
    }

    &:before {
      @media screen and (min-width: $price-block-large) {
        left: $width * 2;
        width: $width;
        background: scale-lightness($price-block-bg,10%);
      }
    }
  }

  &:nth-child(4) {
    background: scale-lightness($price-block-bg, 15%);
    @media screen and (min-width: $price-block-large) {
      width: $width;
    }

    &:before {
      @media screen and (min-width: $price-block-large) {
        left: $width * 3;
        width: $width;
        background: scale-lightness($price-block-bg, 15%);
      }
    }
  }
}


// ============================================================
// $Price Block Header
// ============================================================

.price-block__title {
  margin-top: 0;
  margin-bottom: 1.25rem; // 20px / 16px
  padding: 1.25rem 0 0; // (20px / 16px) 0 0
  font-size: 1.25em; // 20px / 16px
  font-weight: 700;
  line-height: 1;
}

.price-block__cost {
  font-weight: 300;
  font-style: italic;
}


// ============================================================
// $Price Block Button
// ============================================================

.price-block__btn {
  appearance: none;
  border: none;
  margin: 0.625rem 0 0.3125rem; // (10px / 16px) 0 0 (5px / 16px)
  width: 100%;
  background: scale-lightness($price-block-bg, -25%);
  color: #EFEFEF;
  
  &:hover {
    background: scale-lightness($price-block-bg, -15%);
  }
}


// ============================================================
// $Price Block Info
// ============================================================

.price-block__info {
  padding: 0 0 1.25rem; // 0 0 (20px / 16px)
  @media screen and (max-width: $collapsed-price-block) {
    height: 0;
    visibility: hidden;
  }

  &.opened {
    @media screen and (max-width: $collapsed-price-block) {
      height: auto;
      visibility: visible;
    }
  }
}


// ============================================================
// $Price Block Trigger
// ============================================================

.price-block__trigger {
  @media screen and (max-width: $collapsed-price-block) {
    position: absolute;
    top: 5px;
    right: 20px;
    font-size: 1.5625em; // 25px / 16px
    font-style: normal;

    &:hover {
      cursor: pointer;
    }
  }

  @media screen and (min-width: $price-block-large) {
    display: none;
  }
}
              
            
!

JS

              
                function priceToggle(e) {
  e.preventDefault();
  $(this).parent().next().toggleClass('opened');
}

$('.price-block__trigger').on('click', priceToggle);
$('.price-block__trigger').on('touchstart', priceToggle);
              
            
!
999px

Console