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.

            
              <!-- 
Wrote a blog post about how it all works:
http://andymcfee.com/2012/08/24/css3-flip-cards/
-->

<div class="viewport">
  
  <div class="flip-card">
    <div class="card-front">
      Front!
    </div>
    <div class="card-back">
      Back!
    </div>
  </div>
  
  <div class="flip-card">
    <div class="card-front">
      Front!
    </div>
    <div class="card-back">
      Back!
    </div>
  </div>
  
  <div class="flip-card">
    <div class="card-front">
      Front!
    </div>
    <div class="card-back">
      Back!
    </div>
  </div>
  
  <div class="flip-card">
    <div class="card-front">
      Front!
    </div>
    <div class="card-back">
      Back!
    </div>
  </div>
  
  <div class="flip-card">
    <div class="card-front">
      Front!
    </div>
    <div class="card-back">
      Back!
    </div>
  </div>
  
  <div class="flip-card">
    <div class="card-front">
      Front!
    </div>
    <div class="card-back">
      Back!
    </div>
  </div>
  
  <div class="flip-card">
    <div class="card-front">
      Front!
    </div>
    <div class="card-back">
      Back!
    </div>
  </div>
  
  <div class="flip-card">
    <div class="card-front">
      Front!
    </div>
    <div class="card-back">
      Back!
    </div>
  </div>
  
  <div class="flip-card">
    <div class="card-front">
      Front!
    </div>
    <div class="card-back">
      Back!
    </div>
  </div>
  
  <div class="flip-card">
    <div class="card-front">
      Front!
    </div>
    <div class="card-back">
      Back!
    </div>
  </div>
  
  <div class="flip-card">
    <div class="card-front">
      Front!
    </div>
    <div class="card-back">
      Back!
    </div>
  </div>
  
  <div class="flip-card">
    <div class="card-front">
      Front!
    </div>
    <div class="card-back">
      Back!
    </div>
  </div>
  
</div>

            
          
!
            
              @import "compass/css3";

$default-transition-duration: 500ms;
$perspective: 300;

/***
* CSS3 FLIP CARDS
* Markup for an element that a user can hover to reveal content on the back, like a card
* Browser Support: Safari, Firefox, Chrome, IE8+, and Touch Devices; (IE9 and below will not have any flip effect but will just change on hover)
***/

.flip-card {
  display: block;
  position: relative;
  z-index: 1000;
  width: 100px; 
  height: 100px;
  
  .card-front,
  .card-back {
    @include backface-visibility(hidden);
    @include single-transition(transform);
    display: block;
    height: 100%;
    position: absolute;
    width: 100%; 
  }

  .card-front {
    @include transform3d(perspective($perspective) rotateY(0));
    z-index: 900;
  }

  .card-back {
    @include rotateY(-180deg); //Using rotate instead of transform prevents the back of the card from flipping on page load because transition is only targeting transform. Super sweet. 
     z-index: 800;
  }

  &:hover {
    .card-front { 
      @include transform(rotateY(180deg)); //No 3D fallback
      @include transform3d(perspective($perspective) rotateY(180deg)); 
    }
    .card-back { 
      z-index: 950; //No transform fallback
      @include transform(rotateY(0deg)); //No 3D fallback
      @include transform3d(perspective($perspective) rotateY(0deg)); 
    }
  }
}




/*** Just for show... ***/

.flip-card {
  @include text-shadow(1px 1px 0 rgba(darken(#1B8CE8, 20%), .8) );
  color: #fff;
  cursor: pointer;
  float: left;
  font-weight: bold;
  margin: 10px;
  text-align: center;
  text-transform: uppercase;
  min-width: 100px;
  max-width: 400px;
  
  .card-front,
  .card-back {
    @include border-radius(5px);
    @include box-shadow(1px 1px 2px rgba(darken(#1B8CE8, 20%), .8));
    @include box-sizing(border-box);
    border: 1px solid darken(#1B8CE8, 40%);
    padding: 40px 0;
  }

  .card-front {
    @include box-sizing(border-box);
    background-color: #499bea; // Old browsers
  	@include filter-gradient(#499bea, #207ce5, vertical);
		@include background-image(linear-gradient(top,  #499bea 0%,#207ce5 100%));

  }

  .card-back {
    @include box-shadow(0 0 20px rgba(darken(#1B8CE8, 10%), .8) inset);
		background-color: #478ce0; // Old browsers
		@include filter-gradient(#478ce0, #0263db, vertical); // IE6-9
		@include background-image(linear-gradient(top,  #478ce0 0%,#1168db 100%,#0263db 100%));
  } 
}



body {
  background-color: #e6f2f7; // Old browsers
  @include filter-gradient(#e6f2f7, #a0d8ef, horizontal); 
  @include background-image(radial-gradient(center, circle cover,  #e6f2f7 0%,#a0d8ef 100%));

}

.viewport {
  margin: 10px auto 0;
  width: 500px;
}

            
          
!
999px
Loading ..................

Console