Skip to content

Commit a1a82ae

Browse files
committed
Media queries & responsiveness
1 parent 709e3bf commit a1a82ae

File tree

4 files changed

+145
-0
lines changed

4 files changed

+145
-0
lines changed

dist/css/main.css

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,50 @@ main {
151151
overflow: hidden; }
152152
main#home h1 {
153153
margin-top: 20vh; }
154+
155+
@media screen and (min-width: 501px) and (max-width: 768px) {
156+
main {
157+
align-items: center;
158+
text-align: center; }
159+
main .lg-heading {
160+
line-height: 1;
161+
margin-bottom: 1rem; }
162+
ul.menu-nav, div.menu-photo {
163+
float: none;
164+
width: 100%;
165+
min-height: 0; }
166+
ul.menu-nav.show, div.menu-photo.show {
167+
transform: translate3d(0, 0, 0); }
168+
.menu-nav {
169+
height: 70vh;
170+
transform: translate3d(-100%, 0, 0);
171+
font-size: 24px; }
172+
.menu-photo {
173+
height: 30vh;
174+
transform: translate3d(100%, 0, 0); }
175+
.menu-photo .portrait {
176+
background: url("../img/portrait_small.jpg");
177+
width: 150px;
178+
height: 150px; } }
179+
180+
@media screen and (max-width: 500px) {
181+
main#home h1 {
182+
margin-top: 10vh;
183+
text-align: center; }
184+
ul.menu-nav, div.menu-photo {
185+
float: none;
186+
width: 100%;
187+
min-height: 0; }
188+
ul.menu-nav.show, div.menu-photo.show {
189+
transform: translate3d(0, 0, 0); }
190+
.menu-nav {
191+
height: 70vh;
192+
transform: translate3d(-100%, 0, 0);
193+
font-size: 24px; }
194+
.menu-photo {
195+
height: 30vh;
196+
transform: translate3d(100%, 0, 0); }
197+
.menu-photo .portrait {
198+
background: url("../img/portrait_small.jpg");
199+
width: 150px;
200+
height: 150px; } }

scss/_config.scss

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,28 @@ $background-opacity: 0.7;
3636
@return #fff;
3737
}
3838
}
39+
40+
// Media query mixins
41+
@mixin mediaSm {
42+
@media screen and (max-width: 500px) {
43+
@content;
44+
}
45+
}
46+
47+
@mixin mediaMd {
48+
@media screen and (min-width: 501px) and (max-width: 768px) {
49+
@content;
50+
}
51+
}
52+
53+
@mixin mediaLg {
54+
@media screen and (min-width: 769px) and (max-width: 1170px) {
55+
@content;
56+
}
57+
}
58+
59+
@mixin mediaXl {
60+
@media screen and (min-width: 1171px) {
61+
@content;
62+
}
63+
}

scss/_mobile.scss

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Wide screens
2+
@include mediaXl {
3+
}
4+
5+
// Desktops & laptops
6+
@include mediaLg {
7+
}
8+
9+
// Tablets & small laptops
10+
@include mediaMd {
11+
main {
12+
align-items: center;
13+
text-align: center;
14+
.lg-heading {
15+
line-height: 1;
16+
margin-bottom: 1rem;
17+
}
18+
}
19+
ul.menu-nav, div.menu-photo {
20+
float: none;
21+
width: 100%;
22+
min-height: 0;
23+
&.show {
24+
transform: translate3d(0, 0, 0);
25+
}
26+
}
27+
.menu-nav {
28+
height: 70vh;
29+
transform: translate3d(-100%, 0, 0);
30+
font-size: 24px;
31+
}
32+
.menu-photo {
33+
height: 30vh;
34+
transform: translate3d(100%, 0, 0);
35+
.portrait {
36+
background: url('../img/portrait_small.jpg');
37+
width: 150px;
38+
height: 150px;
39+
}
40+
}
41+
}
42+
43+
// Smartphones
44+
@include mediaSm {
45+
main#home h1 {
46+
margin-top: 10vh;
47+
text-align: center;
48+
}
49+
ul.menu-nav, div.menu-photo {
50+
float: none;
51+
width: 100%;
52+
min-height: 0;
53+
&.show {
54+
transform: translate3d(0, 0, 0);
55+
}
56+
}
57+
.menu-nav {
58+
height: 70vh;
59+
transform: translate3d(-100%, 0, 0);
60+
font-size: 24px;
61+
}
62+
.menu-photo {
63+
height: 30vh;
64+
transform: translate3d(100%, 0, 0);
65+
.portrait {
66+
background: url('../img/portrait_small.jpg');
67+
width: 150px;
68+
height: 150px;
69+
}
70+
}
71+
}

scss/main.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,5 @@ main {
6767
}
6868
}
6969
}
70+
71+
@import 'mobile';

0 commit comments

Comments
 (0)