forked from inuitcss/objects.layout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_objects.layout.scss
309 lines (203 loc) · 6.95 KB
/
_objects.layout.scss
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
/*------------------------------------*\
#LAYOUT
\*------------------------------------*/
/**
* The inuitcss layout system uses `box-sizing: border-box;` and
* `display: inline-block;` to create an extremely powerful, flexible
* alternative to the traditional grid system. Combine the layout items with
* the widths found in `trumps.widths`.
*/
// Predefine the variables below in order to alter and enable specific features.
$inuit-layout-namespace: $inuit-namespace !default;
$inuit-layout-gutter: $inuit-base-spacing-unit !default;
$inuit-layout-gutter--tiny: quarter($inuit-layout-gutter) !default;
$inuit-layout-gutter--small: halve($inuit-layout-gutter) !default;
$inuit-layout-gutter--large: double($inuit-layout-gutter) !default;
$inuit-layout-gutter--huge: quadruple($inuit-layout-gutter) !default;
$inuit-enable-layout--tiny: false !default;
$inuit-enable-layout--small: false !default;
$inuit-enable-layout--large: false !default;
$inuit-enable-layout--huge: false !default;
$inuit-enable-layout--flush: false !default;
$inuit-enable-layout--rev: false !default;
$inuit-enable-layout--middle: false !default;
$inuit-enable-layout--bottom: false !default;
$inuit-enable-layout--right: false !default;
$inuit-enable-layout--center: false !default;
$inuit-enable-layout--auto: false !default;
// Here we set a variable assuming that `box-sizing: border-box;` is not set
// globally. If it has been previously been defined, the following variable will
// be overriden and will be set to `true`.
$inuit-global-border-box: false !default;
/**
* Begin a layout group.
*/
.#{$inuit-layout-namespace}layout,
%#{$inuit-layout-namespace}layout {
list-style: none;
margin: 0;
padding: 0;
margin-left: -$inuit-layout-gutter;
}
/**
* 1. Cause columns to stack side-by-side.
* 2. Space columns apart.
* 3. Align columns to the tops of each other.
* 4. Full-width unless told to behave otherwise.
* 5. Required to combine fluid widths and fixed gutters.
*/
.#{$inuit-layout-namespace}layout__item,
%#{$inuit-layout-namespace}layout__item {
display: inline-block; /* [1] */
padding-left: $inuit-layout-gutter; /* [2] */
vertical-align: top; /* [3] */
width: 100%; /* [4] */
@if $inuit-global-border-box == false {
-webkit-box-sizing: border-box; /* [5] */
-moz-box-sizing: border-box; /* [5] */
box-sizing: border-box; /* [5] */
}
}
@if ($inuit-enable-layout--tiny == true) {
/**
* Layouts with tiny gutters.
*/
.#{$inuit-layout-namespace}layout--tiny,
%#{$inuit-layout-namespace}layout--tiny {
margin-left: -($inuit-layout-gutter--tiny);
> .#{$inuit-layout-namespace}layout__item,
> %#{$inuit-layout-namespace}layout__item {
padding-left: $inuit-layout-gutter--tiny;
}
}
}
@if ($inuit-enable-layout--small == true) {
/**
* Layouts with small gutters.
*/
.#{$inuit-layout-namespace}layout--small,
%#{$inuit-layout-namespace}layout--small {
margin-left: -($inuit-layout-gutter--small);
> .#{$inuit-layout-namespace}layout__item,
> %#{$inuit-layout-namespace}layout__item {
padding-left: $inuit-layout-gutter--small;
}
}
}
@if ($inuit-enable-layout--large == true) {
/**
* Layouts with large gutters.
*/
.#{$inuit-layout-namespace}layout--large,
%#{$inuit-layout-namespace}layout--large {
margin-left: -($inuit-layout-gutter--large);
> .#{$inuit-layout-namespace}layout__item,
> %#{$inuit-layout-namespace}layout__item {
padding-left: $inuit-layout-gutter--large;
}
}
}
@if ($inuit-enable-layout--huge == true) {
/**
* Layouts with huge gutters.
*/
.#{$inuit-layout-namespace}layout--huge,
%#{$inuit-layout-namespace}layout--huge {
margin-left: -($inuit-layout-gutter--huge);
> .#{$inuit-layout-namespace}layout__item,
> %#{$inuit-layout-namespace}layout__item {
padding-left: $inuit-layout-gutter--huge;
}
}
}
@if ($inuit-enable-layout--flush == true) {
/**
* Layouts with no gutters.
*/
.#{$inuit-layout-namespace}layout--flush,
%#{$inuit-layout-namespace}layout--flush {
margin-left: 0;
> .#{$inuit-layout-namespace}layout__item,
> %#{$inuit-layout-namespace}layout__item {
padding-left: 0;
}
}
}
@if ($inuit-enable-layout--rev == true) {
/**
* Reversed rendered order of layout items, e.g. items 1, 2, 3, 4 in your
* markup will display in order 4, 3, 2, 1 on your page.
*/
.#{$inuit-layout-namespace}layout--rev,
%#{$inuit-layout-namespace}layout--rev {
direction: rtl;
text-align: left;
> .#{$inuit-layout-namespace}layout__item,
> %#{$inuit-layout-namespace}layout__item {
direction: ltr;
text-align: left;
}
}
}
@if ($inuit-enable-layout--middle == true) {
/**
* Align layout items to the vertical centers of each other.
*/
.#{$inuit-layout-namespace}layout--middle,
%#{$inuit-layout-namespace}layout--middle {
> .#{$inuit-layout-namespace}layout__item,
> %#{$inuit-layout-namespace}layout__item {
vertical-align: middle;
}
}
}
@if ($inuit-enable-layout--bottom == true) {
/**
* Align layout items to the vertical bottoms of each other.
*/
.#{$inuit-layout-namespace}layout--bottom,
%#{$inuit-layout-namespace}layout--bottom {
> .#{$inuit-layout-namespace}layout__item,
> %#{$inuit-layout-namespace}layout__item {
vertical-align: bottom;
}
}
}
@if ($inuit-enable-layout--right == true) {
/**
* Make the layout items fill up from the right hand side.
*/
.#{$inuit-layout-namespace}layout--right,
%#{$inuit-layout-namespace}layout--right {
text-align: right;
> .#{$inuit-layout-namespace}layout__item,
> %#{$inuit-layout-namespace}layout__item {
text-align: left;
}
}
}
@if ($inuit-enable-layout--center == true) {
/**
* Make the layout items fill up from the center outward.
*/
.#{$inuit-layout-namespace}layout--center,
%#{$inuit-layout-namespace}layout--center {
text-align: center;
> .#{$inuit-layout-namespace}layout__item,
> %#{$inuit-layout-namespace}layout__item {
text-align: left;
}
}
}
@if ($inuit-enable-layout--auto == true) {
/**
* Cause layout items to take up a non-explicit amount of width.
*/
.#{$inuit-layout-namespace}layout--auto,
%#{$inuit-layout-namespace}layout--auto {
> .#{$inuit-layout-namespace}layout__item,
> %#{$inuit-layout-namespace}layout__item {
width: auto;
}
}
}