Created
August 11, 2014 12:42
-
-
Save mehlah/27c970ff53b7d5350fd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="card"> | |
<div class="container"> | |
<div class="front"> | |
<img src="http://placehold.it/400x600" /> | |
</div> | |
<div class="back"> | |
<h5>This is a card.</h5> | |
<p>This card shows some content on the front and some on the back, and can be flipped by hovering on a desktop, or by swiping across on a touch device.</p> | |
<p>The back of the card is intentionally long, so that we can show both an example where the card is constrained to a square and where it is as long as the content on either side requires.</p> | |
<p>This card shows some content on the front and some on the back, and can be flipped by hovering on a desktop, or by swiping across on a touch device.</p> | |
<p>The back of the card is intentionally long, so that we can show both an example where the card is constrained to a square and where it is as long as the content on either side requires.</p> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.card { | |
position: relative; | |
padding: 0; | |
margin: 0; | |
-webkit-perspective: 5000; | |
perspective: 5000; | |
} | |
.card .container { | |
-webkit-transform-style: preserve-3d; | |
transform-style: preserve-3d; | |
-webkit-transition: 0.6s; | |
transition: 0.6s; | |
} | |
.card .container .front, .card .container .back { | |
width: 100%; | |
-webkit-backface-visibility: hidden; | |
backface-visibility: hidden; | |
} | |
.card .container .front .row, .card .container .front .column, .card .container .front .columns, .card .container .back .row, .card .container .back .column, .card .container .back .columns { | |
-webkit-backface-visibility: hidden; | |
backface-visibility: hidden; | |
} | |
.card .container .front { | |
z-index: 2; | |
} | |
.card .container .back { | |
position: absolute; | |
height: 100%; | |
left: 0; | |
top: 0; | |
overflow-y: scroll; | |
-webkit-transform: rotateY(180deg); | |
transform: rotateY(180deg); | |
} | |
.card .container:hover { | |
-webkit-transform: rotate3d(0, 1, 0, 180deg); | |
transform: rotate3d(0, 1, 0, 180deg); | |
} | |
.card .container { | |
border: solid 1px #eeeeee; | |
} | |
.card .container .front, .card .container .back { | |
padding: 1em; | |
} | |
.card.square .container { | |
width: 100%; | |
height: 0; | |
padding-bottom: 100%; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment