-
Notifications
You must be signed in to change notification settings - Fork 0
/
style.css
196 lines (160 loc) · 3.31 KB
/
style.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');
* {
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: "Roboto", sans-serif;
background-color: #e9e9e9;
}
html {
font-size: 62.5%;
}
.container {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
/* align-items: center; */
padding: 8rem 2rem;
}
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
column-gap: 2rem;
place-items: center;
row-gap: 8rem;
}
.card {
width: 32.8rem;
height: 40rem;
border-radius: 1.5rem;
overflow: hidden;
position: relative;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
}
.card:nth-child(1) {
background-image: url(image/bamboo-garden.jpg);
}
.card:nth-child(2) {
background-image: url(image/mount-fuji.jpg);
}
.card:nth-child(3) {
background-image: url(image/shinto\ shrine.jpg);
}
.details {
position: absolute;
bottom: -15rem;
z-index: 9;
width: 28rem;
display: flex;
flex-direction: column;
padding: 2rem 2.5rem;
left: 0;
right: 0;
margin-inline: auto;
background-color: white;
border-radius: 1rem;
box-shadow: 0 8px 24px hsla(0, 0%, 0%, .15);
opacity: 0;
transition: opacity 1s 1s;
}
.card img {
width: 100%;
}
.details p, .details h2, .details a {
background-color: white;
}
.details p {
font-size: 1.2rem;
letter-spacing: 1;
}
.details h2 {
font-size: 2rem;
margin-top: .4rem;
margin-bottom: 1.5rem;
font-weight: 500;
}
.details a {
font-size: 1.2rem;
font-weight: 500;
letter-spacing: 2;
text-decoration: none;
}
.details a:hover {
text-decoration: underline;
}
/* animation */
.card:hover .details {
opacity: 1;
animation: show-details 1s forwards;
transition: opacity .3s;
}
.card:not(:hover) .details {
animation: hide-details 1s forwards;
}
.card:hover {
animation: remove-overflow 2s forwards;
}
.card:not(:hover) {
animation: apply-overflow 2s forwards;
}
@keyframes show-details {
50% {
transform: translateY(-16rem);
}
100% {
transform: translateY(-13rem);
}
}
@keyframes remove-overflow {
to {
overflow: initial;
}
}
@keyframes hide-details {
0% {
transform: translateY(-13rem);
}
50% {
transform: translateY(-16rem);
}
100% {
transform: translateY(.5rem);
}
}
@keyframes apply-overflow {
0% {
overflow: initial;
pointer-events: none;
}
50% {
overflow: hidden;
}
}
/* media queries */
/* 991px → font-size: 60%; ,
768px,
450px → font-size: 55%; */
@media (max-width: 991px) {
html {
font-size: 60%;
}
.grid {
grid-template-columns: repeat(2, 1fr);
}
.container {
height: auto;
}
}
@media (max-width: 768px) {
.grid {
grid-template-columns: repeat(1, 1fr);
}
}
@media (max-width: 450px) {
html {
font-size: 55%;
}
}