This repository has been archived by the owner on Oct 23, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmq.less
102 lines (85 loc) · 1.79 KB
/
mq.less
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
//
// Name: Media Queries Library (Less)
// Description: Really simple media queries in Less.
// Version: 3.0.0
//
// Author: Denis Malinochkin
// Git: https://github.com/mrmlnc/less-mq
//
// twitter: @mrmlnc
//
// ------------------------------------
// Width Screen
// ------------------------------------
.min(@min, @ruleset) {
@media (min-width: @min) {
@ruleset();
}
}
.max(@max, @ruleset) {
@media (max-width: (@max - 1)) {
@ruleset();
}
}
.screen(@min, @max, @ruleset) {
@media (min-width: @min) and (max-width: (@max - 1)) {
@ruleset();
}
}
// Height
// ------------------------------------
.min-height(@min, @ruleset) {
@media (min-height: @min) {
@ruleset();
}
}
.max-height(@max, @ruleset) {
@media (max-height: (@max - 1)) {
@ruleset();
}
}
.screen-height(@min, @max, @ruleset) {
@media (min-height: @min) and (max-height: (@max - 1)) {
@ruleset();
}
}
// Orientation
// ------------------------------------
.landscape(@ruleset) {
@media (orientation: landscape) {
@ruleset();
}
}
.portrait(@ruleset) {
@media (orientation: portrait) {
@ruleset();
}
}
// HiDPI (Alias: ratio and retina)
// ------------------------------------
.hdpi(@ratio: 1.5, @ruleset: default) {
& when (isnumber(@ratio)) {
@media
only screen and (min-resolution: (round(@ratio * 96dpi))),
only screen and (min-resolution: (@ratio * 1dppx)) {
@ruleset();
}
}
& when (isruleset(@ratio)) {
@media
only screen and ( min-resolution: 144dpi),
only screen and ( min-resolution: 1.5dppx) {
@ratio();
}
}
}
.ratio(@ratio, @ruleset: default) {
.hdpi(@ratio, @ruleset);
}
// Print
// ------------------------------------
.print(@ruleset) {
@media print {
@ruleset();
}
}