Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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="price-block--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";

// $Globals
*,:before,:after {box-sizing: border-box;}html{font: normal 100%/1.5 sans-serif;word-wrap: break-word;}html,body{height: 100%;}

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

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


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

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

// ============================================================
// $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;
  }

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

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

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

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


// ============================================================
// $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