<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<button id="btn">Запустить заново!</button>
<section class="memory-game">
<div class="memory-card" data-icon='icon1'>
<img class="front-face" src="img/1.png" alt="icon1">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon1'>
<img class="front-face" src="img/1.png" alt="icon1">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon2'>
<img class="front-face" src="img/2.png" alt="2">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon2'>
<img class="front-face" src="img/2.png" alt="2">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon3'>
<img class="front-face" src="img/3.png" alt="icon3">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon3'>
<img class="front-face" src="img/3.png" alt="icon3">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon4'>
<img class="front-face" src="img/4.png" alt="4">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon4'>
<img class="front-face" src="img/4.png" alt="4">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon5'>
<img class="front-face" src="img/5.png" alt="5">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon5'>
<img class="front-face" src="img/5.png" alt="5">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon6'>
<img class="front-face" src="img/6.png" alt="6">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon6'>
<img class="front-face" src="img/6.png" alt="6">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon7'>
<img class="front-face" src="img/7.png" alt="7">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon7'>
<img class="front-face" src="img/7.png" alt="7">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon8'>
<img class="front-face" src="img/8.png" alt="8">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
<div class="memory-card" data-icon='icon8'>
<img class="front-face" src="img/8.png" alt="8">
<img class="back-face" src="img/front.png" alt="Memory Card">
</div>
</section>
<button id="btn-mix"></button>
<script src="./js/main.js"></script>
</body>
</html>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
height: 100vh;
display: flex;
background: gray;
}
.memory-game {
width: 640px;
height: 640px;
margin: auto;
display: flex;
flex-wrap: wrap;
perspective: 1000px;
}
.memory-card {
width: calc(25% - 10px);
height: calc(33.333% - 10px);
margin: 5px;
position: relative;
box-shadow: 1px 1px 1px rgba(0, 0, 0, .3);
transform: scale(1);
transform-style: preserve-3d;
transition: transform .5s;
}
.front-face,
.back-face {
width: 100%;
height: 100%;
padding: 20px;
position: absolute;
border-radius: 5px;
background: #1C7CCC;
backface-visibility: hidden;
}
.memory-card:active {
transform: scale(0.97);
transition: transform .2s;
}
.memory-card.flip {
transform: rotateY(180deg);
}
.front-face {
transform: rotateY(180deg);
}