Skip to content

Instantly share code, notes, and snippets.

@avaly
Created March 17, 2014 12:10
Show Gist options
  • Save avaly/9598160 to your computer and use it in GitHub Desktop.
Save avaly/9598160 to your computer and use it in GitHub Desktop.
Untitled
.parent {
max-width: 300px;
padding: 2em;
background: #cfc;
perspective: 1000px;
}
.shape {
position: relative;
height: 0;
padding-bottom: 62.96%;
}
.flip {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: .5s;
transform-style: preserve-3d;
transform-origin: right center;
}
.parent:hover .flip {
transform: translateX(-100%) rotateY(-180deg);
}
.card {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
backface-visibility: hidden;
}
.front {
background: #fcc;
transform: rotateY(0deg);
}
.back {
background: #ccf;
transform: rotateY(180deg);
}
<div class="parent">
<div class="shape">
<div class="flip">
<div class="card front">
Front
<a href="#aaa">link</a>
</div>
<div class="card back">
Back
<a href="#bbb">link</a>
</div>
</div>
</div>
</div>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment