-
Notifications
You must be signed in to change notification settings - Fork 0
/
memory_game.css
143 lines (127 loc) · 2.91 KB
/
memory_game.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
background: linear-gradient(to right, lightyellow, rgb(237, 245, 132));
display: flex;
position: relative;
font-family: "Comic Sans MS";
font-weight: bold;
}
.winningpic {
position: absolute;
top: 28%;
right: 18%;
z-index: 3;
width: 40%;
height: 40%;
visibility: hidden;
}
h1.winningword {
position: absolute;
z-index: 4;
top: 80%;
right: 35%;
text-shadow: 2px 2px 5px black;
animation: colorswitching 1s infinite;
}
@keyframes colorswitching {
0% {
color: red;
}
25% {
color: green;
}
50% {
color: yellow;
}
75% {
color: blue;
}
100% {
color: white;
}
}
img#joeychandlerdance {
width: 500px;
object-fit: cover;
}
.leftpart {
display: flex;
flex-direction: column;
width: 30%;
padding-left: 5%;
padding-top: 5%;
}
.gameframe {
width: 780px;
height: 550px;
display: flex;
flex-wrap: wrap;
margin: auto;
/* border: 2px solid green; */
perspective: 1000px;
}
.game_card {
width: 20%;
height: 31%;
margin: 5px;
/* border: 2px solid blue; */
position: relative;
transform: scale(1);
transform-style: preserve-3d;
transition: transform 0.5s;
/* 上一層要搭配perspective:1000px才能成功 */
cursor: pointer;
}
.game_card.fliped {
/* 用toggle加上的字前面會多一個. 在css中操作時要注意 */
transform: rotateY(180deg);
}
/* 按下去的效果 */
.game_card:active {
transform: scale(0.95);
transition: transform 0.5s;
}
.front_face,
.back_face {
width: 100%;
height: 100%;
position: absolute;
/* border: 2px solid red; */
border-radius: 5%;
backface-visibility: hidden;
}
.front_face {
transform: rotateY(180deg);
}
.done {
width: 20%;
height: 31%;
margin: 5px;
/* border: 2px solid blue; */
position: relative;
}
.done>.back_face {
visibility: hidden;
}
.done>.front_face {
transform: none;
}
button {
margin-top: 10%;
margin-left: 15%;
width: 50%;
height: 10%;
border-radius: 5%;
background-color: steelblue;
border: none;
color: white;
text-align: center;
text-decoration: none;
font-size: 16px;
cursor: pointer;
}