@@ -6,229 +6,160 @@ body {
6
6
background : rgb (123 , 158 , 158 );
7
7
}
8
8
# hexGrid {
9
- overflow : hidden;
10
- width : 90% ;
11
- margin : 0 auto;
12
- padding : 0.866% 0 ;
13
- font-family : 'Raleway' , sans-serif;
14
- font-size : 15px ;
15
- }
16
- # hexGrid : after {
17
- content : "" ;
18
- display : block;
19
- clear : both;
9
+ display : flex;
10
+ flex-wrap : wrap;
11
+ width : 90% ;
12
+ margin : 0 auto;
13
+ overflow : hidden;
14
+ font-family : 'Raleway' , sans-serif;
15
+ font-size : 15px ;
16
+ list-style-type : none;
20
17
}
18
+
21
19
.hex {
22
- position : relative;
23
- list-style-type : none;
24
- float : left;
25
- overflow : hidden;
26
- visibility : hidden;
27
- outline : 1px solid transparent; /* fix for jagged edges in FF on hover transition */
28
- -webkit-transform : rotate (-60deg ) skewY (30deg ) translatez (-1px );
29
- -ms-transform : rotate (-60deg ) skewY (30deg ) translatez (-1px );
30
- transform : rotate (-60deg ) skewY (30deg ) translatez (-1px );
31
- }
32
- .hex * {
33
- position : absolute;
34
- visibility : visible;
35
- outline : 1px solid transparent; /* fix for jagged edges in FF on hover transition */
36
- }
37
- .hexIn {
20
+ position : relative;
21
+ visibility : hidden;
22
+ outline : 1px solid transparent; /* fix for jagged edges in FF on hover transition */
23
+ }
24
+ .hex ::after {
25
+ content : '' ;
26
+ display : block;
27
+ padding-bottom : 86.602% ; /* = 100 / tan(60) * 1.5 */
28
+ }
29
+ .hexIn {
30
+ position : absolute;
31
+ width : 96% ;
32
+ padding-bottom : 110.851% ; /* = width / sin(60) */
33
+ margin : 0 2% ;
34
+ overflow : hidden;
35
+ visibility : hidden;
36
+ outline : 1px solid transparent; /* fix for jagged edges in FF on hover transition */
37
+ -webkit-transform : rotate3d (0 , 0 , 1 , -60deg ) skewY (30deg );
38
+ -ms-transform : rotate3d (0 , 0 , 1 , -60deg ) skewY (30deg );
39
+ transform : rotate3d (0 , 0 , 1 , -60deg ) skewY (30deg );
40
+ }
41
+ .hexIn * {
42
+ position : absolute;
43
+ visibility : visible;
44
+ outline : 1px solid transparent; /* fix for jagged edges in FF on hover transition */
45
+ }
46
+ .hexLink {
38
47
display : block;
39
48
width : 100% ;
40
49
height : 100% ;
41
50
text-align : center;
42
51
color : # fff ;
43
52
overflow : hidden;
44
- -webkit-transform : skewY (-30deg ) rotate ( 60deg );
45
- -ms-transform : skewY (-30deg ) rotate ( 60deg );
46
- transform : skewY (-30deg ) rotate ( 60deg );
53
+ -webkit-transform : skewY (-30deg ) rotate3d ( 0 , 0 , 1 , 60deg );
54
+ -ms-transform : skewY (-30deg ) rotate3d ( 0 , 0 , 1 , 60deg );
55
+ transform : skewY (-30deg ) rotate3d ( 0 , 0 , 1 , 60deg );
47
56
}
48
57
49
58
/*** HEX CONTENT **********************************************************************/
50
59
.hex img {
51
- left : -100% ;
52
- right : -100% ;
53
- width : auto;
54
- height : 100% ;
55
- margin : 0 auto;
60
+ left : -100% ;
61
+ right : -100% ;
62
+ width : auto;
63
+ height : 100% ;
64
+ margin : 0 auto;
65
+ -webkit-transform : rotate3d (0 , 0 , 0 , 0deg );
66
+ -ms-transform : rotate3d (0 , 0 , 0 , 0deg );
67
+ transform : rotate3d (0 , 0 , 0 , 0deg );
56
68
}
57
69
58
70
.hex h1 , .hex p {
59
- width : 102% ;
60
- left : -1% ; /* prevent line on the right where background doesn't cover image */
61
- padding : 5% ;
62
- box-sizing : border-box;
63
- background-color : rgba (0 , 128 , 128 , 0.8 );
64
- font-weight : 300 ;
65
- -webkit-transition : -webkit-transform .2s ease-out, opacity .3s ease-out;
66
- transition : transform .2s ease-out, opacity .3s ease-out;
71
+ width : 100% ;
72
+ padding : 5% ;
73
+ box-sizing : border-box;
74
+ background-color : rgba (0 , 128 , 128 , 0.8 );
75
+ font-weight : 300 ;
76
+ -webkit-transition : -webkit-transform .2s ease-out, opacity .3s ease-out;
77
+ transition : transform .2s ease-out, opacity .3s ease-out;
67
78
}
68
79
.hex h1 {
69
- bottom : 50% ;
70
- padding-top : 50% ;
71
- font-size : 1.5em ;
72
- z-index : 1 ;
73
- -webkit-transform : translateY ( -100% ) translatez ( -1 px );
74
- -ms-transform : translateY ( -100% ) translatez ( -1 px );
75
- transform : translateY ( -100% ) translatez ( -1 px );
76
- }
77
- .hex h1 : after {
78
- content : '' ;
79
- position : absolute;
80
- bottom : 0 ;
81
- left : 45% ;
82
- width : 10% ;
83
- text-align : center;
84
- border-bottom : 1px solid # fff ;
80
+ bottom : 50% ;
81
+ padding-top : 50% ;
82
+ font-size : 1.5em ;
83
+ z-index : 1 ;
84
+ -webkit-transform : translate3d ( 0 , -100% , 0 );
85
+ -ms-transform : translate3d ( 0 , -100% , 0 );
86
+ transform : translate3d ( 0 , -100% , 0 );
87
+ }
88
+ .hex h1 :: after {
89
+ content : '' ;
90
+ position : absolute;
91
+ bottom : 0 ;
92
+ left : 45% ;
93
+ width : 10% ;
94
+ text-align : center;
95
+ border-bottom : 1px solid # fff ;
85
96
}
86
97
.hex p {
87
- top : 50% ;
88
- padding-bottom : 50% ;
89
- -webkit-transform : translateY ( 100% ) translatez ( -1 px );
90
- -ms-transform : translateY ( 100% ) translatez ( -1 px );
91
- transform : translateY ( 100% ) translatez ( -1 px );
98
+ top : 50% ;
99
+ padding-bottom : 50% ;
100
+ -webkit-transform : translate3d ( 0 , 100% , 0 );
101
+ -ms-transform : translate3d ( 0 , 100% , 0 );
102
+ transform : translate3d ( 0 , 100% , 0 );
92
103
}
93
104
94
105
95
106
/*** HOVER EFFECT **********************************************************************/
96
- .hexIn : hover h1 , .hexIn : focus h1 ,
97
- .hexIn : hover p , .hexIn : focus p {
98
- -webkit-transform : translateY ( 0 % ) translatez ( -1 px );
99
- -ms-transform : translateY ( 0 % ) translatez ( -1 px );
100
- transform : translateY ( 0 % ) translatez ( -1 px );
107
+ .hexLink : hover h1 , .hexLink : focus h1 ,
108
+ .hexLink : hover p , .hexLink : focus p {
109
+ -webkit-transform : translate3d ( 0 , 0 , 0 );
110
+ -ms-transform : translate3d ( 0 , 0 , 0 );
111
+ transform : translate3d ( 0 , 0 , 0 );
101
112
}
102
113
103
114
/*** SPACING AND SIZING *****************************************************************/
104
115
@media (min-width : 1201px ) { /* <- 5-4 hexagons per row */
105
- .hex {
106
- width : 19.2% ; /* = (100-4) / 5 */
107
- padding-bottom : 22.170% ; /* = width / sin(60deg) */
108
- }
109
- .hex : nth-child (9n+6),
110
- .hex : nth-child (9n+7),
111
- .hex : nth-child (9n+8),
112
- .hex : nth-child (9n+9) {
113
- margin-top : -4.676% ;
114
- margin-bottom : -4.676% ;
115
- -webkit-transform : translateX (50% ) rotate (-60deg ) skewY (30deg );
116
- -ms-transform : translateX (50% ) rotate (-60deg ) skewY (30deg );
117
- transform : translateX (50% ) rotate (-60deg ) skewY (30deg );
118
- }
119
- .hex : nth-child (9n+6): last-child ,
120
- .hex : nth-child (9n+7): last-child ,
121
- .hex : nth-child (9n+8): last-child ,
122
- .hex : nth-child (9n+9): last-child {
123
- margin-bottom : 0 ;
124
- }
125
- .hex : nth-child (9n+6) {
126
- margin-left : 0.5% ;
127
- clear : left;
128
- }
129
- .hex : nth-child (9n+10) {
130
- clear : left;
131
- }
132
- .hex : nth-child (9n+2),
133
- .hex : nth-child (9n+ 7) {
134
- margin-left : 1% ;
135
- margin-right : 1% ;
136
- }
137
- .hex : nth-child (9n+3),
138
- .hex : nth-child (9n+4),
139
- .hex : nth-child (9n+8) {
140
- margin-right : 1% ;
141
- }
116
+ # hexGrid {
117
+ padding-bottom : 4.4%
118
+ }
119
+ .hex {
120
+ width : 20% ; /* = 100 / 5 */
121
+ }
122
+ .hex : nth-child (9n+6){ /* first hexagon of even rows */
123
+ margin-left : 10% ; /* = width / 2 */
124
+ }
142
125
}
143
- @media (max-width : 1200px ) and (min-width : 901px ) {/* <- 4-3 hexagons per row */
144
- .hex {
145
- width : 24.25% ; /* = (100-3) / 4 */
146
- padding-bottom : 28.001% ; /* = width / sin(60deg) */
147
- }
148
- .hex : nth-child (7n+5),
149
- .hex : nth-child (7n+6),
150
- .hex : nth-child (7n+7) {
151
- margin-top : -6.134% ;
152
- margin-bottom : -6.134% ;
153
- -webkit-transform : translateX (50% ) rotate (-60deg ) skewY (30deg );
154
- -ms-transform : translateX (50% ) rotate (-60deg ) skewY (30deg );
155
- transform : translateX (50% ) rotate (-60deg ) skewY (30deg );
156
- }
157
- .hex : nth-child (7n+5): last-child ,
158
- .hex : nth-child (7n+6): last-child ,
159
- .hex : nth-child (7n+7): last-child {
160
- margin-bottom : 0 ;
161
- }
162
- .hex : nth-child (7n+2),
163
- .hex : nth-child (7n+6) {
164
- margin-left : 1% ;
165
- margin-right : 1% ;
166
- }
167
- .hex : nth-child (7n+3) {
168
- margin-right : 1% ;
169
- }
170
- .hex : nth-child (7n+8) {
171
- clear : left;
172
- }
173
- .hex : nth-child (7n+5) {
174
- clear : left;
175
- margin-left : 0.5% ;
176
- }
126
+
127
+ @media (max-width : 1200px ) and (min-width : 901px ) { /* <- 4-3 hexagons per row */
128
+ # hexGrid {
129
+ padding-bottom : 5.5%
130
+ }
131
+ .hex {
132
+ width : 25% ; /* = 100 / 4 */
133
+ }
134
+ .hex : nth-child (7n+5){ /* first hexagon of even rows */
135
+ margin-left : 12.5% ; /* = width / 2 */
136
+ }
177
137
}
138
+
178
139
@media (max-width : 900px ) and (min-width : 601px ) { /* <- 3-2 hexagons per row */
179
- .hex {
180
- width : 32.666% ; /* = (100-2) / 3 */
181
- padding-bottom : 37.720% ; /* = width / sin(60) */
182
- }
183
- .hex : nth-child (5n+4),
184
- .hex : nth-child (5n+5) {
185
- margin-top : -8.564% ;
186
- margin-bottom : -8.564% ;
187
- -webkit-transform : translateX (50% ) rotate (-60deg ) skewY (30deg );
188
- -ms-transform : translateX (50% ) rotate (-60deg ) skewY (30deg );
189
- transform : translateX (50% ) rotate (-60deg ) skewY (30deg );
190
- }
191
- .hex : nth-child (5n+4): last-child ,
192
- .hex : nth-child (5n+5): last-child {
193
- margin-bottom : 0 ;
194
- }
195
- .hex : nth-child (5n+4) {
196
- margin-right : 1% ;
197
- margin-left : 0.5% ;
198
- }
199
- .hex : nth-child (5n+2) {
200
- margin-left : 1% ;
201
- margin-right : 1% ;
202
- }
203
- .hex : nth-child (5n+6) {
204
- clear : left;
205
- }
140
+ # hexGrid {
141
+ padding-bottom : 7.4%
142
+ }
143
+ .hex {
144
+ width : 33.333% ; /* = 100 / 3 */
145
+ }
146
+ .hex : nth-child (5n+4){ /* first hexagon of even rows */
147
+ margin-left : 16.666% ; /* = width / 2 */
148
+ }
206
149
}
150
+
207
151
@media (max-width : 600px ) { /* <- 2-1 hexagons per row */
208
- .hex {
209
- width : 49.5% ; /* = (100-1) / 2 */
210
- padding-bottom : 57.158% ; /* = width / sin(60) */
211
- }
212
- .hex : nth-child (3n+3) {
213
- margin-top : -13.423% ;
214
- margin-bottom : -13.423% ;
215
- -webkit-transform : translateX (50% ) rotate (-60deg ) skewY (30deg );
216
- -ms-transform : translateX (50% ) rotate (-60deg ) skewY (30deg );
217
- transform : translateX (50% ) rotate (-60deg ) skewY (30deg );
218
- }
219
- .hex : nth-child (3n+3): last-child {
220
- margin-bottom : 0 ;
221
- }
222
- .hex : nth-child (3n+3) {
223
- margin-left : 0.5% ;
224
- }
225
- .hex : nth-child (3n+2) {
226
- margin-left : 1% ;
227
- }
228
- .hex : nth-child (3n+4) {
229
- clear : left;
230
- }
152
+ # hexGrid {
153
+ padding-bottom : 11.2%
154
+ }
155
+ .hex {
156
+ width : 50% ; /* = 100 / 3 */
157
+ }
158
+ .hex : nth-child (3n+3){ /* first hexagon of even rows */
159
+ margin-left : 25% ; /* = width / 2 */
160
+ }
231
161
}
162
+
232
163
@media (max-width : 400px ) {
233
164
# hexGrid {
234
165
font-size : 13px ;
0 commit comments