<div class="grids">
<div class="card-one">
<div class="card">
<div class="card__side card__side--front" id="front-1">
<div class="text-box">
<h3 class="text-box-top">Flipping Cards</h3>
<h1 class="text-box-middle">Awesome!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
<div class="card__side card__side--back" id="back-1">
<div class="text-box">
<h3 class="text-box-top">Cards Flipped</h3>
<h1 class="text-box-middle">Great!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
</div>
</div>
<div class="card-two">
<div class="card">
<div class="card__side card__side--front" id="front-2">
<div class="text-box">
<h3 class="text-box-top">Flipping Cards</h3>
<h1 class="text-box-middle">Awesome!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
<div class="card__side card__side--back" id="back-2">
<div class="text-box">
<h3 class="text-box-top">Cards Flipped</h3>
<h1 class="text-box-middle">Great!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
</div>
</div>
<div class="card-three">
<div class="card">
<div class="card__side card__side--front" id="front-3">
<div class="text-box">
<h3 class="text-box-top">Flipping Cards</h3>
<h1 class="text-box-middle">Awesome!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
<div class="card__side card__side--back" id="back-3">
<div class="text-box">
<h3 class="text-box-top">Cards Flipped</h3>
<h1 class="text-box-middle">Great!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
</div>
</div>
<div class="card-four">
<div class="card">
<div class="card__side card__side--front" id="front-4">
<div class="text-box">
<h3 class="text-box-top">Flipping Cards</h3>
<h1 class="text-box-middle">Awesome!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
<div class="card__side card__side--back" id="back-4">
<div class="text-box">
<h3 class="text-box-top">Cards Flipped</h3>
<h1 class="text-box-middle">Great!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
</div>
</div>
<div class="card-five">
<div class="card">
<div class="card__side card__side--front" id="front-5">
<div class="text-box">
<h3 class="text-box-top">Flipping Cards</h3>
<h1 class="text-box-middle">Awesome!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
<div class="card__side card__side--back" id="back-5">
<div class="text-box">
<h3 class="text-box-top">Cards Flipped</h3>
<h1 class="text-box-middle">Great!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
</div>
</div>
<div class="card-six">
<div class="card">
<div class="card__side card__side--front" id="front-6">
<div class="text-box">
<h3 class="text-box-top">Flipping Cards</h3>
<h1 class="text-box-middle">Awesome!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
<div class="card__side card__side--back" id="back-6">
<div class="text-box">
<h3 class="text-box-top">Cards Flipped</h3>
<h1 class="text-box-middle">Great!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
</div>
</div>
<div class="card-seven">
<div class="card">
<div class="card__side card__side--front" id="front-7">
<div class="text-box">
<h3 class="text-box-top">Flipping Cards</h3>
<h1 class="text-box-middle">Awesome!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
<div class="card__side card__side--back" id="back-7">
<div class="text-box">
<h3 class="text-box-top">Cards Flipped</h3>
<h1 class="text-box-middle">Great!</h1>
<h3 class="text-box-lower">--- More Text ---</h3>
</div>
</div>
</div>
</div>
</div>
@import url("https://fonts.googleapis.com/css?family=Rubik:400,700&display=swap");
*,
*::after,
*::before {
margin: 0;
padding: 0;
box-sizing: inherit;
}
html {
font-size: 48.5%;
}
body {
background: orange;
font-family: "Rubik", sans-serif;
font-weight: 400;
line-height: 1.7;
padding: 3rem;
box-sizing: border-box;
}
.grids {
max-width: 136rem;
margin: 0 auto;
display: grid;
grid-template-columns: 1fr 1fr;
grid-column-gap: 3rem;
grid-row-gap: 3rem;
}
.card-one {
grid-column: 1/4;
}
.card-two {
grid-column: 1/4;
}
.card-three {
grid-column: 1/4;
}
.card-four {
grid-column: 1/4;
}
.card-five {
grid-column: 1/4;
}
.card-six {
grid-column: 1/4;
}
.card-seven {
grid-column: 1/4;
}
.card {
perspective: 150rem;
-moz-perspective: 150rem;
position: relative;
height: 25rem;
width: 100%;
transition: all ease-in-out 400ms;
cursor: pointer;
}
.card:hover {
transform: scale(1.05);
}
.card:active {
transform: translateY(-1px);
}
.card__side {
transition: all 0.8s ease;
color: white;
font-size: 2rem;
position: absolute;
top: 0;
left: 0;
height: 25rem;
width: 100%;
backface-visibility: hidden;
box-shadow: 2px 4px 16px rgba(0, 0, 0, 0.4);
border-radius: 8px;
}
.card__side--front {
background-color: #2196f3;
position: relative;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.card__side--back {
background-color: #303f9f;
transform: rotateY(180deg);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.showGreen {
transform: rotateY(-180deg);
}
.showRed {
transform: rotateY(0);
}
.text-box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
width: 100%;
}
.text-box-top {
font-size: 2.2rem;
text-shadow: 2px 2px 10px #0000006c;
font-weight: 400;
}
.text-box-middle {
font-size: 5.5rem;
font-weight: 700;
text-shadow: 2px 2px 10px #0000006c;
}
.text-box-lower {
font-size: 2rem;
text-shadow: 2px 2px 10px #0000006c;
font-weight: 400;
}
.heading {
transition: all 0.6s linear;
}
.hide {
visibility: hidden;
opacity: 0;
}
.show {
visibility: visible;
opacity: 1;
}
#front-1 {
background-image: linear-gradient(
rgba(204, 30, 88, 0.6),
rgba(20, 20, 20, 0.6)
),
url("https://images.unsplash.com/photo-1527529482837-4698179dc6ce?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80");
}
#front-2 {
background-image: linear-gradient(
rgba(31, 136, 168, 0.767),
rgba(14, 46, 65, 0.9)
),
url("https://images.unsplash.com/photo-1508599804355-8ce5238b44b1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80");
}
#front-3 {
background-image: linear-gradient(
rgba(84, 86, 175, 0.9),
rgba(27, 27, 85, 0.9)
),
url("https://images.unsplash.com/photo-1499914485622-a88fac536970?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80");
}
#front-4 {
background-image: linear-gradient(
rgba(74, 190, 122, 0.767),
rgba(6, 66, 48, 0.9)
),
url("https://images.unsplash.com/photo-1531206715517-5c0ba140b2b8?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80");
}
#front-5 {
background-image: linear-gradient(
rgba(128, 74, 190, 0.767),
rgba(42, 6, 66, 0.9)
),
url("https://images.unsplash.com/photo-1522071820081-009f0129c71c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80");
}
#front-6 {
background-image: linear-gradient(
rgba(214, 21, 86, 0.801),
rgba(20, 20, 20, 0.6)
),
url("https://images.unsplash.com/photo-1491438590914-bc09fcaaf77a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80");
}
#front-7 {
background-image: linear-gradient(
rgba(31, 136, 168, 0.767),
rgba(14, 46, 65, 0.9)
),
url("https://images.unsplash.com/photo-1520881363902-a0ff4e722963?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80");
}
/* Back */
#back-1 {
background-image: linear-gradient(
rgba(204, 30, 88, 0.6),
rgba(20, 20, 20, 0.6)
),
url("https://images.unsplash.com/photo-1527529482837-4698179dc6ce?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80");
}
#back-2 {
background-image: linear-gradient(
rgba(31, 136, 168, 0.767),
rgba(14, 46, 65, 0.9)
),
url("https://images.unsplash.com/photo-1508599804355-8ce5238b44b1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80");
}
#back-3 {
background-image: linear-gradient(
rgba(84, 86, 175, 0.9),
rgba(27, 27, 85, 0.9)
),
url("https://images.unsplash.com/photo-1499914485622-a88fac536970?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=600&q=80");
}
#back-4 {
background-image: linear-gradient(
rgba(74, 190, 122, 0.767),
rgba(6, 66, 48, 0.9)
),
url("https://images.unsplash.com/photo-1531206715517-5c0ba140b2b8?ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80");
}
#back-5 {
background-image: linear-gradient(
rgba(128, 74, 190, 0.767),
rgba(42, 6, 66, 0.9)
),
url("https://images.unsplash.com/photo-1522071820081-009f0129c71c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80");
}
#back-6 {
background-image: linear-gradient(
rgba(214, 21, 86, 0.801),
rgba(20, 20, 20, 0.6)
),
url("https://images.unsplash.com/photo-1491438590914-bc09fcaaf77a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80");
}
#back-7 {
background-image: linear-gradient(
rgba(31, 136, 168, 0.767),
rgba(14, 46, 65, 0.9)
),
url("https://images.unsplash.com/photo-1520881363902-a0ff4e722963?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80");
}
@media screen and (min-width: 1024px) {
html {
font-size: 62.5%;
}
.grids {
max-width: 136rem;
margin: 0 auto;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-column-gap: 3rem;
grid-row-gap: 3rem;
}
.card-one {
grid-column: 1/3;
}
.card-two {
grid-column: 3/4;
}
.card-three {
grid-column: 1/2;
}
.card-four {
grid-column: 2/2;
}
.card-five {
grid-column: 3/4;
}
.card-six {
grid-column: 1/2;
}
.card-seven {
grid-column: 2/4;
}
}
var flipCheck = 0;
function rotateCards() {
if (flipCheck === 0) {
document.getElementById("front-2").classList.add("showGreen");
document.getElementById("back-2").classList.add("showRed");
document.getElementById("front-1").classList.add("showGreen");
document.getElementById("back-1").classList.add("showRed");
flipCheck = 1;
setTimeout(function () {
document.getElementById("front-4").classList.add("showGreen");
document.getElementById("back-4").classList.add("showRed");
document.getElementById("front-3").classList.add("showGreen");
document.getElementById("back-3").classList.add("showRed");
document.getElementById("front-5").classList.add("showGreen");
document.getElementById("back-5").classList.add("showRed");
setTimeout(function () {
document.getElementById("front-6").classList.add("showGreen");
document.getElementById("back-6").classList.add("showRed");
document.getElementById("front-7").classList.add("showGreen");
document.getElementById("back-7").classList.add("showRed");
}, 500);
}, 500);
} else {
document.getElementById("front-2").classList.remove("showGreen");
document.getElementById("back-2").classList.remove("showRed");
document.getElementById("front-1").classList.remove("showGreen");
document.getElementById("back-1").classList.remove("showRed");
flipCheck = 0;
setTimeout(function () {
document.getElementById("front-3").classList.remove("showGreen");
document.getElementById("back-3").classList.remove("showRed");
document.getElementById("front-4").classList.remove("showGreen");
document.getElementById("back-4").classList.remove("showRed");
document.getElementById("front-5").classList.remove("showGreen");
document.getElementById("back-5").classList.remove("showRed");
setTimeout(function () {
document.getElementById("front-7").classList.remove("showGreen");
document.getElementById("back-7").classList.remove("showRed");
document.getElementById("front-6").classList.remove("showGreen");
document.getElementById("back-6").classList.remove("showRed");
}, 500);
}, 500);
}
}
setInterval(rotateCards, 3000);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.