A Pen by Sonya Moisset on CodePen.
Created
August 16, 2015 14:05
-
-
Save SonyaMoisset/b362363e30163f7f6eca to your computer and use it in GitHub Desktop.
Card Flipping Effect
This file contains hidden or 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-container"> | |
<div class="card"> | |
<div class="front"><h1>Front</h1></div> | |
<div class="back"><h1>Back</h1></div> | |
</div> | |
<div class="card"> | |
<div class="front"><h1>Front</h1></div> | |
<div class="back"><h1>Back</h1></div> | |
</div> | |
<div class="card"> | |
<div class="front"><h1>Front</h1></div> | |
<div class="back"><h1>Back</h1></div> | |
</div> | |
</div> |
This file contains hidden or 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
h1 { | |
margin: 0; | |
} | |
.card-container { | |
perspective: 700; | |
} | |
.card { | |
position: relative; | |
display: inline-block; | |
color: #fff; | |
text-align: center; | |
line-height: 200px; | |
margin: 20px; | |
width: 200px; | |
height: 200px; | |
transition: all 0.6s ease; | |
transform-style: preserve-3d; | |
} | |
.front, .back { | |
position: absolute; | |
top:0; | |
left:0; | |
width: 200px; | |
height: 200px; | |
backface-visibility: hidden; | |
} | |
.front { | |
background: #88ff55; | |
} | |
.back { | |
background: #ff8855; | |
transform: rotateY(180deg); | |
} | |
.card:hover { | |
transform: rotateY(180deg); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment