-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyle.css
More file actions
85 lines (76 loc) · 1.76 KB
/
Copy pathstyle.css
File metadata and controls
85 lines (76 loc) · 1.76 KB
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
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #121826;
color: white;
font-family: sans-serif;
}
h1 {
margin-bottom: 20px;
}
/* The Game Board Container */
.memory-game {
width: 640px;
height: 480px;
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(3, 1fr);
gap: 15px;
/* Perspective gives the 3D flip a realistic depth effect */
perspective: 1000px;
}
/* Individual Card Setup */
.memory-card {
position: relative;
border-radius: 8px;
cursor: pointer;
/* Allows the front and back to share the 3D space */
transform-style: preserve-3d;
/* Smooth animation for the flip */
transition: transform 0.5s ease-in-out;
}
/* Clicking down on a card makes it slightly smaller for a physical feel */
.memory-card:active {
transform: scale(0.97);
transition: transform 0.2s;
}
/* Both faces of the card */
.front-face,
.back-face {
width: 100%;
height: 100%;
position: absolute;
border-radius: 8px;
display: flex;
justify-content: center;
align-items: center;
font-size: 3rem;
/* Hides the "back" of the element when it rotates away from the camera */
backface-visibility: hidden;
box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
/* The Front (Emoji) - initially flipped away from the user */
.front-face {
background-color: #ffffff;
transform: rotateY(180deg);
}
/* The Back (Star) - facing the user initially */
.back-face {
background-color: #4f46e5;
}
/*
The Flip Class
Your JavaScript will add this class to a card when clicked.
It rotates the whole card 180 degrees, revealing the front-face.
*/
.memory-card.flip {
transform: rotateY(180deg);
}