This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemory-card.css
101 lines (94 loc) · 2.47 KB
/
memory-card.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
* {
margin: 0;
padding: 0;
box-sizing: border-box;
/* margin isnt included here */
}
body {
height: 100vh;
background-color: #060ab2;
display: flex;
}
.memory-game {
height: 640px;
width: 640px;
display: flex;
flex-wrap: wrap;
/* items layed out into multiple rows */
/*
flex-item {
flex : 1; this means each 'one' of you will take the same amount of space
}
flex-container {
flex-direction : row ; being in row
flex-wrap : nowrap; in just one row
justify-content : flex-start; from left to right
align-items : stretch; stretch out into the container height
}
*/
margin: auto;
perspective: 1000px;
}
.memory-card {
/*3 rows 4 card seach*/
width: calc(25% - 10px);
height: calc(33.3333% - 10px);
position: relative;
margin: 5px;
transform: scale(1);
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform-style: preserve-3d;
transition: transform 0.3s;
-webkit-transition: transform 0.3s;
-moz-transition: transform 0.3s;
-ms-transition: transform 0.3s;
-o-transition: transform 0.3s;
}
.memory-card:active {
transform: scale(0.97);
-webkit-transform: scale(0.97);
-moz-transform: scale(0.97);
-ms-transform: scale(0.97);
-o-transform: scale(0.97);
transition: transform 0.2s;
-webkit-transition: transform 0.2s;
-moz-transition: transform 0.2s;
-ms-transition: transform 0.2s;
-o-transition: transform 0.2s;
}
/* there is no space between the names cause they belongs to the same element */
.memory-card.flip {
transform: rotateY(180deg);
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
}
.front-face,
.front-back {
width: 100%;
height: 100%;
padding: 20%;
position: absolute;
/*it will be position relative to its parent element so we need to aply it to its parents or else it will be positioned by the parent of the parent of the parent*/
border: 2px solid deeppink;
background: #1c7ccc;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
/* every element in html has a backface or a mirror so we have to hide it and show our specific backface
*/
backface-visibility: hidden;
}
.front-face {
transform: rotateY(180deg);
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
}