forked from leafo/scssphp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathat_root.scss
More file actions
149 lines (138 loc) · 2.5 KB
/
at_root.scss
File metadata and controls
149 lines (138 loc) · 2.5 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
.parent-inline-selector {
color: white;
@at-root .child { color: black; }
}
.parent-block {
color: white;
@at-root {
.child1 { color: green; }
.child2 { color: blue; }
}
.step-child { color: black; }
}
.first {
color: red;
}
body{
.second {
color: white;
@at-root {
.nested1 {
color: blue;
@at-root {
.nested2 {
color: yellow;
}
}
color: orange;
}
}
color: black;
}
}
.third {
color: green;
}
@media print {
.page {
width: 8in;
@at-root (without: media) {
color: red;
}
}
}
.my-widget {
@media (min-width: 300px) {
.inside-mq {
inside-style: mq;
}
@at-root (without: media){
//this without:media tells the screen what to bust out of
.outside-mq {
outside-style: mq;
}
}
// using (without:all) forces all nested selectors outside of all media
// queries, hence color:blue only in the .outside-everything class in generated css
@at-root (without:all){
.outside-class {
color: blue;
}
}
// using the (with:media) keeps .with-only inside media query hence .with-only selector
// inside @media ()min-width:300px
@at-root (with: media) {
.with-only {
// do this ONLY inside mq
color: pink;
}
}
}
}
// without: rule - default - outside of all css rules, but inside directives
@media screen and (max-width:320px) {
.foo {
margin: 0;
@at-root (without: rule) {
.bar {
padding: 0;
}
}
@at-root (without: media rule) {
.baar {
padding: 0;
}
}
@at-root (without: media) {
.barr {
padding: 0;
}
}
}
}
// with: rule - outside of all directives but preserve any css rules
@media screen and (max-width:640px) {
.foo {
@supports ( display: flex ) {
@at-root (with: rule) {
.bar {
width: 0;
}
}
@at-root (with: supports) {
.baz {
height: 0;
}
}
@at-root (with: media) {
.qux {
margin: 0;
}
}
@at-root (with: media rule) {
.quux {
padding: 0;
}
}
@at-root (with: rule) {
.quix {
padding: 0;
}
}
}
}
}
$table-padding: 10px !default;
@mixin table($padding: $table-padding) {
@at-root {
tbody {
padding: $padding;
}
}
}
.test{
.test2{
padding: 0px;
@include table;
}
}