This repository was archived by the owner on Aug 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathnamed-media-queries.scss
More file actions
74 lines (58 loc) · 1.55 KB
/
Copy pathnamed-media-queries.scss
File metadata and controls
74 lines (58 loc) · 1.55 KB
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
// MEDIA QUERY BUBBLING ------------------------------------------ //
// SCSS
.sidebar {
width: 300px;
@media screen and (min-width: 1000px) {
width: 500px;
}
}
/* OUTPUT - Same as CSS */
.sidebar {
width: 300px;
}
@media screen and (min-width: 1000px) {
.sidebar {
width: 500px;
}
}
// NAMED MEDIA QUERIES ------------------------------------------ //
// Define your breakpoint sizes; these are based on min-width MQ's
// e.g. tiny is 0-499px
$tiny: 0;
$small: 500px;
$medium: 1000px;
$large: 1300px;
// Breakpoint Mixin
@mixin breakpoint($media) {
// if the media is 'tiny'
@if $media == tiny {
// define mediaquery with variable
@media only screen and (min-width: $tiny) {
// print content CSS
@content;
}
}
@else if $media == small {
// small and medium are 1px smaller than their previous variable
@media only screen and (min-width: $small - 1) {
@content;
}
}
@else if $media == medium {
@media only screen and (min-width: $medium - 1) {
@content;
}
}
@else if $media == large {
@media only screen and (min-width: $large) {
@content;
}
}
}
// Use in your Stylesheets
.page-wrap {
@include breakpoint(tiny) { width: 95%; } // at 0 to 499px
@include breakpoint(small) { width: 80%; } // at 500px to 999px
@include breakpoint(medium) { width: 70%; } // at 1000px to 1299px
@include breakpoint(large) { width: 60%; } // 1300px and up
}