Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Hardly-Human/756e82c263a0940dd782de00d23ca63e to your computer and use it in GitHub Desktop.
Save Hardly-Human/756e82c263a0940dd782de00d23ca63e to your computer and use it in GitHub Desktop.
ampersand flash card | css knockout text + flip animation

ampersand flash card | css knockout text + flip animation

I've been loving space-y images + knockout text + hand lettering lately and I've always been a fan of CSS animation, so here we are.

A Pen by Eina O on CodePen.

License.

<div class="container" ontouchstart="this.classList.toggle('hover');">
<div class="card">
<div class="card_front">
<h1 class="card-symbol">&#128628;</h1>
</div>
<div class="card_back">
<h1 class="card-symbol">&#128628;</h1>
<div class="card-text">
<p>The word <strong>ampersand</strong> is a corruption of the phrase "and per se & (and)", meaning "and intrinsically the word and (represented by the symbol &)".</p>
<p>The ampersand can be traced back to the 1st century A.D. and the Old Roman cursive, in which the letters E and T occasionally were written together to form a ligature.</p>
</div>
</div>
</div>
</div>
/*
TUTORIALS:
CSS Flip: https://davidwalsh.name/css-flip
Knockout Text: https://codepen.io/thebabydino/pen/qONMLv?editors=110
*/
@import url('https://fonts.googleapis.com/css?family=Cantata+One');
@import url('https://fonts.googleapis.com/css?family=Lato');
html {
box-sizing: border-box;
font-family: 'Lato', sans-serif;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
background-color: #bdc2e8;
background-image: linear-gradient(to top, #bdc2e8 0%, #bdc2e8 1%, #e6dee9 100%);
background-repeat: no-repeat;
}
/* CARD STYLING */
.container,
.card,
.card_front,
.card_back {
width: 397px;
height: 640px;
margin: 3em auto;
}
.card_front,
.card_back {
/* height: 100%; */
background: url('http://i280.photobucket.com/albums/kk195/thelittleblacksmith/lobster-nebula_zps2j1cvbkx.jpg') no-repeat;
box-shadow: 0px 5px 25px 0px rgba(51,51,51,0.28);
}
.card-symbol {
margin: 0;
width: 100%;
text-align: center;
color: #000;
font-family: 'Cantata One', serif;
font-size: 13em;
mix-blend-mode: lighten;
}
@supports(display:flex){
.card_front {
display: flex;
align-items: center;
justify-content: center;
}
.card_front .card-symbol {
margin: 0 0.15em;
border-radius: 50%;
font-size: 15em;
}
}
.card_front {
position: relative;
padding: 0 1em;
}
.card_front .card-symbol {
font-size: 15em;
}
.card_back {
/* display: none; */
padding: 1em;
}
.card_front > *,
.card_back > * {
background-color: white;
background-color: rgba(255, 255, 255, 0.75);
}
.card-text {
padding: 0 4.5em 1em;
line-height: 1.4;
}
p:first-of-type {
margin-top: 0;
padding: 1.5em 0 0;
border-top: 8px solid #333;
}
/* FLIP CARD STYLING */
.container {
perspective: 1000px;
}
.container:hover .card,
.container.hover {
transform: rotateY(-180deg);
}
.card {
transition: 0.6s;
transform-style: preserve-3d;
position: relative;
}
.card_front,
.card_back {
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
}
.card_front {
z-index: 2;
transform: rotateY(0deg);
}
.card_back {
transform: rotateY(-180deg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment