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 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

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="container-fluid">
  <div class="row">
    <div class="col-md-12">
      <p>This borrows from <a href="https://davidwalsh.name/css-flip">David Walsh's css-flip solution</a></p>
      <p>In this version, cards can be variable heights</p>
    </div>
  </div>
  
</div>
<div class="container">
  <div class="row">
    <div class="col-md-4">
      <div class="flip-container" ontouchstart="this.classList.toggle('hover');">
        <div class="flipper">
          <div class="front">
            <!-- front content -->
            <div class="panel panel-default">
              <div class="panel-heading">
                <h2 class="panel-title">Card 1 Title Front</h2>
              </div>
              <div class="panel-body">
                <p>Card 1 front content</p>
                <p>Morbi sagittis ante id urna varius molestie. Pellentesque a sem vel velit bibendum posuere. Praesent consectetur consequat neque, eu iaculis urna commodo et.</p>
              </div>
              <div class="panel-footer">Card 1 has equal amounts</div>
            </div> <!-- .panel -->
          </div> <!-- .front -->
          <div class="back">
            <!-- back content -->
            <div class="panel panel-default">
              <div class="panel-heading">
                <h2 class="panel-title">Card 1 Title Back</h2>
              </div>
              <div class="panel-body">
                <p>Card 1 back content</p>
                <p>Maecenas venenatis nisl posuere, blandit justo eget, ultrices nisi. Duis scelerisque metus sed massa tempor ornare. Proin non tortor vel sapien convallis elementum.</p>
              </div>
              <div class="panel-footer">Card 1 footer back</div>
            </div> <!-- .panel -->
          </div> <!-- .back -->
        </div> <!-- .flipper -->
      </div> <!-- .flip-container -->
    </div> <!-- .col-md-4 -->
    <div class="col-md-4">
      <div class="flip-container" ontouchstart="this.classList.toggle('hover');">
        <div class="flipper">
          <div class="front">
            <!-- front content -->
            <div class="panel panel-default">
              <div class="panel-heading">
                <h2 class="panel-title">Card 2 Title Front</h2>
              </div>
              <div class="panel-body">
                <p>Card 2 front content</p>
                <p>Morbi sagittis ante id urna varius molestie. Pellentesque a sem vel velit bibendum posuere. Praesent consectetur consequat neque, eu iaculis urna commodo et.</p>
                <p>Quisque viverra enim ac vestibulum maximus. Pellentesque feugiat enim ut risus pulvinar venenatis. Aliquam at scelerisque nisl.</p>
              </div>
              <div class="panel-footer">Card 2 has more on the front</div>
            </div> <!-- .panel -->
          </div> <!-- .front -->
          <div class="back">
            <!-- back content -->
            <div class="panel panel-default">
              <div class="panel-heading">
                <h2 class="panel-title">Card 2 Title Back</h2>
              </div>
              <div class="panel-body">
                <p>Card 2 back content</p>
                <p>Maecenas venenatis nisl posuere, blandit justo eget, ultrices nisi. Duis scelerisque metus sed massa tempor ornare. Proin non tortor vel sapien convallis elementum.</p>
              </div>
              <div class="panel-footer">Card 2 footer back</div>
            </div> <!-- .panel -->
          </div> <!-- .back -->
        </div> <!-- .flipper -->
      </div> <!-- .flip-container -->
    </div> <!-- .col-md-4 -->
    <div class="col-md-4">
      <div class="flip-container" data-toggle="click" ontouchstart="this.classList.toggle('hover');">
        <div class="flipper">
          <div class="front">
            <!-- front content -->
            <div class="panel panel-default">
              <div class="panel-heading">
                <h2 class="panel-title">Card 3 Title Front</h2>
              </div>
              <div class="panel-body">
                <p>Card 3 front content</p>
                <p>Morbi sagittis ante id urna varius molestie. Pellentesque a sem vel velit bibendum posuere. Praesent consectetur consequat neque, eu iaculis urna commodo et.</p>
              </div>
              <div class="panel-footer">Card 3 has more on the back</div>
            </div> <!-- .panel -->
          </div> <!-- .front -->
          <div class="back">
            <!-- back content -->
            <div class="panel panel-default">
              <div class="panel-heading">
                <h2 class="panel-title">Card 3 Title Back</h2>
              </div>
              <div class="panel-body">
                <p>Card 3 back content</p>
                <p>Morbi sagittis ante id urna varius molestie. Pellentesque a sem vel velit bibendum posuere. Praesent consectetur consequat neque, eu iaculis urna commodo et. Maecenas venenatis nisl posuere, blandit justo eget, ultrices nisi. Duis scelerisque metus sed massa tempor ornare. Proin non tortor vel sapien convallis elementum. Quisque viverra enim ac vestibulum maximus. Pellentesque feugiat enim ut risus pulvinar venenatis. Aliquam at scelerisque nisl. Duis non nibh a arcu mollis maximus non sit amet massa. Aliquam id mollis elit. Ut semper scelerisque ullamcorper. Aliquam accumsan luctus nunc et finibus.</p>
                <p>Morbi sagittis ante id urna varius molestie. Pellentesque a sem vel velit bibendum posuere. Praesent consectetur consequat neque, eu iaculis urna commodo et. Maecenas venenatis nisl posuere, blandit justo eget, ultrices nisi. Duis scelerisque metus sed massa tempor ornare. Proin non tortor vel sapien convallis elementum. Quisque viverra enim ac vestibulum maximus. Pellentesque feugiat enim ut risus pulvinar venenatis. Aliquam at scelerisque nisl. Duis non nibh a arcu mollis maximus non sit amet massa. Aliquam id mollis elit. Ut semper scelerisque ullamcorper. Aliquam accumsan luctus nunc et finibus.</p>
              </div>
              <div class="panel-footer">Card 3 footer back</div>
            </div> <!-- .panel -->
          </div> <!-- .back -->
        </div> <!-- .flipper -->
      </div> <!-- .flip-container -->
    </div> <!-- .col-md-4 -->
    
  </div>
  <div class="row">
    <div class="col-md-12">
      <div class="alert alert-info">
        <p>This row will always be below the cards</p>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                /* pen setup */
body {
  background: gray;
  // margin-top: 20px;
  .container-fluid {
    background: #ffecb3;
    margin-bottom: 20px;
  }
}

/* entire container, keeps perspective */
.flip-container {
  perspective: 1000px;
  transform-style: preserve-3d;
  overflow: hidden;
  /*  UPDATED! flip the pane when hovered */
  // &:hover{
  //   .back { transform: rotateY(0deg); }
  //   .front { transform: rotateY(180deg); }
  // }
  &.flip {
    .back { transform: rotateY(0deg); }
    .front { transform: rotateY(180deg); }
  }

}

.flip-container, .front, .back {
  // width: 320px;
  height: auto;
}

/* flip speed goes here */
.flipper {
  transition: 0.6s;
  transform-style: preserve-3d;
  width: 200%;
  position: relative;
}

/* hide back of pane during swap */
.front, .back {
  backface-visibility: hidden;
  transition: 0.6s;
  transform-style: preserve-3d;
  float: left;
  width: 50%;
  // position: absolute;
  // top: 0;
  // left: 0;
}

/*  UPDATED! front pane, placed above back */
.front {
  z-index: 2;
  transform: rotateY(0deg);
  position: relative;
}

/* back, initially hidden pane */
.back {
  transform: rotateY(-180deg);
  margin-left: -50%;
}

/*
  Some vertical flip updates
*/
.vertical {
  &.flip-container {
    position: relative;
    &:hover {
      .back { transform: rotateX(0deg); }
      .front { transform: rotateX(180deg); }
    }
  }
  .back { transform: rotateX(180deg); }
}

              
            
!

JS

              
                (function($) {
  $('.flip-container[data-toggle="click"]').on('click', function(e) {
    $(this).toggleClass('flip');
  });
})(jQuery);
              
            
!
999px

Console