1
1
<!DOCTYPE html>
2
2
< html lang ="en ">
3
+
3
4
< head >
4
5
< meta charset ="UTF-8 ">
5
6
< title > Flex Panels 💪</ title >
6
7
< link href ='https://fonts.googleapis.com/css?family=Amatic+SC ' rel ='stylesheet ' type ='text/css '>
7
8
</ head >
9
+
8
10
< body >
9
11
< style >
10
12
html {
14
16
font-size : 20px ;
15
17
font-weight : 200 ;
16
18
}
17
-
19
+
18
20
body {
19
21
margin : 0 ;
20
22
}
21
-
22
- * , * : before , * : after {
23
+
24
+ * ,
25
+ * : before ,
26
+ * : after {
23
27
box-sizing : inherit;
24
28
}
25
29
26
30
.panels {
27
31
min-height : 100vh ;
28
32
overflow : hidden;
33
+ display : flex;
29
34
}
30
35
31
36
.panel {
32
37
background : # 6B0F9C ;
33
- box-shadow : inset 0 0 0 5px rgba (255 , 255 , 255 , 0.1 );
38
+ box-shadow : inset 0 0 0 5px rgba (255 , 255 , 255 , 0.1 );
34
39
color : white;
35
40
text-align : center;
36
41
align-items : center;
37
42
/* Safari transitionend event.propertyName === flex */
38
43
/* Chrome + FF transitionend event.propertyName === flex-grow */
39
44
transition :
40
- font-size 0.7s cubic-bezier (0.61 , -0.19 , 0.7 , -0.11 ),
41
- flex 0.7s cubic-bezier (0.61 , -0.19 , 0.7 , -0.11 ),
45
+ font-size 0.7s cubic-bezier (0.61 , -0.19 , 0.7 , -0.11 ),
46
+ flex 0.7s cubic-bezier (0.61 , -0.19 , 0.7 , -0.11 ),
42
47
background 0.2s ;
43
48
font-size : 20px ;
44
49
background-size : cover;
45
50
background-position : center;
51
+ flex : 1 ;
52
+ justify-content : center;
53
+ align-items : center;
54
+ display : flex;
55
+ flex-direction : column;
56
+ }
57
+
58
+ .panel1 {
59
+ background-image : url (https://source.unsplash.com/gYl-UtwNg_I/1500x1500);
46
60
}
47
61
48
- .panel1 { background-image : url (https://source.unsplash.com/gYl-UtwNg_I/1500x1500); }
49
- .panel2 { background-image : url (https://source.unsplash.com/rFKUFzjPYiQ/1500x1500); }
50
- .panel3 { background-image : url (https://images.unsplash.com/photo-1465188162913-8fb5709d6d57?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&cs=tinysrgb&w=1500&h=1500&fit=crop&s=967e8a713a4e395260793fc8c802901d); }
51
- .panel4 { background-image : url (https://source.unsplash.com/ITjiVXcwVng/1500x1500); }
52
- .panel5 { background-image : url (https://source.unsplash.com/3MNzGlQM7qs/1500x1500); }
62
+ .panel2 {
63
+ background-image : url (https://source.unsplash.com/rFKUFzjPYiQ/1500x1500);
64
+ }
65
+
66
+ .panel3 {
67
+ background-image : url (https://images.unsplash.com/photo-1465188162913-8fb5709d6d57?ixlib=rb-0.3.5&q=80&fm=jpg&crop=faces&cs=tinysrgb&w=1500&h=1500&fit=crop&s=967e8a713a4e395260793fc8c802901d);
68
+ }
69
+
70
+ .panel4 {
71
+ background-image : url (https://source.unsplash.com/ITjiVXcwVng/1500x1500);
72
+ }
73
+
74
+ .panel5 {
75
+ background-image : url (https://source.unsplash.com/3MNzGlQM7qs/1500x1500);
76
+ }
53
77
54
78
/* Flex Children */
55
- .panel > * {
79
+ .panel > * {
56
80
margin : 0 ;
57
81
width : 100% ;
58
82
transition : transform 0.5s ;
83
+ flex : 1 0 auto;
84
+ display : flex;
85
+ justify-content : center;
86
+ align-items : center;
87
+ }
88
+
89
+ .panel > * : first-child {
90
+ transform : translateY (-100% );
91
+ }
92
+
93
+ .panel .open-active > * : first-child {
94
+ transform : translateY (0 );
95
+ }
96
+
97
+ .panel > * : last-child {
98
+ transform : translateY (100% );
99
+ }
100
+
101
+ .panel .open-active > * : last-child {
102
+ transform : translateY (0 );
59
103
}
60
104
61
105
.panel p {
64
108
text-shadow : 0 0 4px rgba (0 , 0 , 0 , 0.72 ), 0 0 14px rgba (0 , 0 , 0 , 0.45 );
65
109
font-size : 2em ;
66
110
}
67
-
111
+
68
112
.panel p : nth-child (2 ) {
69
113
font-size : 4em ;
70
114
}
71
115
72
116
.panel .open {
117
+ flex : 5 ;
73
118
font-size : 40px ;
74
119
}
75
-
76
120
</ style >
77
121
78
122
104
148
</ div >
105
149
</ div >
106
150
107
- < script >
108
-
109
- </ script >
110
-
111
-
151
+ < script src ="typescripts.js "> </ script >
112
152
113
153
</ body >
114
- </ html >
154
+
155
+ </ html >
0 commit comments