<body>
<!--<div class="row">-->
<div class="card-edge">
<div class="card">
<div class="card-face front">
<h1>?</h1>
<p>What could this be</p>
</div>
<div class="card-face back">
<h2>It's a <small>surprise!</small></h2>
</div>
</div><!--end border-->
</div><!--end card-->
<!--<div class="card alt">
<div class="card-face front">
<h1>?</h1>
<p>これは何でしょうか</p>
</div>
<div class="card-face back">
<p>それで手を打とう!</p>
<p>BUY</p>
</div>
</div>
</div>-->
</body>
:root {
--pink: rgba(255, 130, 253, 1);
--pepto: rgba(255, 39, 253, 1);
--purple: rgba(127, 111, 253, 1);
--violet: rgba(127, 66, 253, 1);
}
* {
margin: 0;
padding: 0;
}
body {
font-family: monterrat, sans-serif;
width: 100%;
min-height: 100vh;
}
/*
.row {
width: 100%;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-around;
}
*/
.card-edge {
color: white;
width: 210px;
height: 300px;
padding: 0;
margin: 100px auto 0;
transition: transform 0.5s ease-in-out;
transform-style: preserve-3d;
perspective: 600px;
position: relative;
}
.alt {
background-image: linear-gradient(to bottom right, var(--pink), var(--pepto));
}
.card {
width: 100%;
height: 100%;
transition: transform 1s;
transform-style: preserve-3d;
cursor: pointer;
position: relative;
}
.card.is_flipped {
transform: rotateY(180deg);
}
.card-face {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
backface-visibility: hidden;
overflow: hidden;
border-radius: 16px;
box-shadow: 0px 3px 18px 3px rgba(0, 0, 0, 0.2)
}
.card-face.back {
background-image: linear-gradient(to bottom right, var(--purple), var(--violet));
display: flex;
flex-direction: column;
align-items: center;
transform: rotateY(180deg);
justify-contents: center;
}
.card-face.back h2 {
margin-top: 0.8em;
line-height: 0.7em;
}
.card-face.back h2 small {
font-size: 0.6em;
}
.card-face.front {
background-image: linear-gradient(to bottom right, var(--pink), var(--pepto));
backface-visibility: hidden;
}
.card h1 {
font-size: 4em;
text-align: center;
line-height: 1em;
padding: 20% 0 0 0;
margin: 0;
}
.card h2 {
font-size: 4em;
text-align: center;
line-height: 1em;
padding: 20% 0 0 0;
margin: 0;
}
.card p {
font-size: 1em;
text-align: center;
}
var card = document.querySelector('.card');
card.addEventListener('pointerover', (event) => {
card.classList.toggle('is_flipped');
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.