You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lost Grid is a grid system for SCSS or Stylus. It is built upon years of studying grid systems and building dozens of grid systems with tons of community feedback.
11
+
Lost Grid is a grid system for SCSS or Stylus. It is built upon years of studying and [building](http://jeet.gs)grid systems with **tons** of community feedback.
12
12
13
-
It makes use of [`calc()`](http://caniuse.com/#feat=calc) to create stunning grids based on fractions you define.
13
+
It makes use of [`calc()`](https://webdesign.tutsplus.com/tutorials/calc-grids-are-the-best-grids--cms-22902) to create stunning grids based on fractions you define.
14
+
15
+
I can tell you with no ego, this is [my finest grid](https://www.youtube.com/watch?v=EnjtQQQaDKo).
14
16
15
17
16
18
## Better than X
17
-
Lost is better than any grid system out there and it can prove it.
19
+
Lost is better than any grid system out there and can prove it.
Lost works by creating **blocks**. Think of these blocks as columns in a traditional grid system, except they can go vertical as well. To create a basic horizontal grid, just insert some blocks into an element like so and pass a fraction (**as a string**) to `block()`.
44
+
Lost works by creating **blocks**. Think of these blocks as columns in a traditional grid system, except they can go vertical as well. To create a basic horizontal grid, just insert some blocks into any element like so and pass a fraction (**as a string**) to `block()`.
43
45
44
46
```html
45
47
<section>
@@ -64,7 +66,7 @@ You can also make use of the `center()` mixin to assign a `max-width` and `margi
64
66
65
67
```stylus
66
68
section
67
-
cf($max-size: 1200px, $pad: $gutter)
69
+
center(980px)
68
70
69
71
figure
70
72
block('1/2')
@@ -104,7 +106,7 @@ You can `offset` columns easily. To offset in the other direction, pass a negati
104
106
```html
105
107
<section>
106
108
<figure>1</figure>
107
-
<figure>3</figure>
109
+
<figure>2</figure>
108
110
</section>
109
111
```
110
112
@@ -169,33 +171,6 @@ for $i in 1..12
169
171
block(s('%s/12', $i), $output: bare)
170
172
```
171
173
172
-
```css
173
-
[class*="col-"] {
174
-
float: left;
175
-
margin-right: 30px;
176
-
}
177
-
[class*="col-"]:last-child {
178
-
margin-right: 0;
179
-
}
180
-
[class*="col-"]:nth-child(n) {
181
-
clear: none;
182
-
}
183
-
[class*="col-"]:nth-child(1n + 1) {
184
-
clear: both;
185
-
}
186
-
[class*="col-"]:nth-child(1n) {
187
-
margin-right: 0;
188
-
float: right;
189
-
}
190
-
.col-1 {
191
-
width: calc(100%*1/12- (30px-30px/12));
192
-
}
193
-
.col-2 {
194
-
width: calc(100%*2/12- (30px-30px/12));
195
-
}
196
-
...
197
-
```
198
-
199
174
Once you've mastered the basic horizontal grid system (it shouldn't take long), you can start to make vertical grids that have the same vertical gutters as your horizontal grids. Just pass `$dir: column` to your `block()` mixin. The blocks will stretch to fill their container's height, so if you'd like to see them take up the full height of the page, set `height: 100%` on your container.
200
175
201
176
No other grid system in the world supports vertical grids.
@@ -247,7 +222,6 @@ Lost supports masonry plugins like [Isotope](http://isotope.metafizzy.co/). To a
247
222
<figure>1</figure>
248
223
<figure>2</figure>
249
224
<figure>3</figure>
250
-
...
251
225
</section>
252
226
```
253
227
@@ -261,7 +235,8 @@ figure
261
235
262
236
263
237
## Grid Settings
264
-
Just set any of these in a settings file after you `@import` Lost and before you use a Lost mixin.
238
+
239
+
Just set either of these in a settings file after you `@import` Lost and before you use a Lost mixin.
265
240
266
241
-`$gutter = 30px`
267
242
-`$rtl = false`
@@ -279,6 +254,7 @@ section
279
254
edit(red)
280
255
```
281
256
257
+
282
258
##### `cf()`
283
259
Clearfix used to clear floated children blocks. http://nicolasgallagher.com/micro-clearfix-hack
284
260
@@ -289,6 +265,7 @@ Clearfix used to clear floated children blocks. http://nicolasgallagher.com/micr
Creates a block that is a fraction of the size of it's containing element with a gutter. Think of this like a column except it can go vertical as well by setting $dir to 'column' or 'both'. You don't need to pass any additional ratios (fractions) as the grid system will make use of calc(). Note that fractions must always be wrapped in quotes.
309
287
310
288
-`$fraction = '1/1'` - This is a simple fraction of the containing element's width or height depending on $dir. This must be a string written as a fraction.
311
289
-`$dir = row` - The direction of the grid. Can be row (horizontal grid), column (vertical grid), or both (waffle grid).
312
-
-`$cycle = 1`- Lost works by assigning a margin-right to all elements except the last in the row. It does this by default by using the denominator of the fraction you pick. To override this default use this param.
290
+
-`$cycle = convert(unquote(split('/', $fraction)[1]))` (gets the denominator) - Lost works by assigning a margin-right to all elements except the last in the row. It does this by default by using the denominator of the fraction you pick. To override this default use this param. e.g. block('2/4', $cycle: 2)
313
291
-`$gut = $gutter` - The margin on the side of the element used to create a gutter. Typically this is left alone and the global $gutter will be used, but you can override it here if you want certain elements to have a particularly large or small gutter (pass 0 for no gutter at all).
314
-
-`$output = normal` - Determines what type of code to output. Accepts normal (all styles for a block), init (the initial styles of any block), or bare (just the width of the block). Useful for creating CSS grid classes like .col-x with Lost.
315
292
-`$masonry-friendly = false` - Dictates whether this particular group of elements will work well with JS masonry plugins. This will assign a margin on each side of the element and you will need to wrap this group of elements in a masonry-row().
293
+
-`$output = normal` - Determines what type of code to output. Accepts normal (all styles for a block), init (the initial styles of any block), or bare (just the width of the block). Useful for creating CSS grid classes like .col-x with Lost.
316
294
317
295
```stylus
318
296
figure
319
297
block('1/3')
320
298
```
321
299
322
-
##### `masonry-row()`
323
-
Creates a row element for working with JS masonry libraries like Isotope. Assigns a negative margin on each side of this wrapping element.
324
-
325
-
-`$gut = $gutter` - How large the gutter involved is, typically this won't be adjusted and will inherit the global $gutter setting, but it's made available if you want your masonry grid to have a special $gut, it should match your blocks' $guts.
326
-
327
-
```stylus
328
-
section
329
-
masonry-row()
330
-
figure
331
-
block('1/3', $masonry-friendly: true)
332
-
```
333
300
334
301
##### `offset()`
335
-
Margin to the left, right, bottom, or top, of an element depending on if the fraction passed is positive or negative. It works for both horizontal and vertical grids but not both. On vertical grids, the margin-top will create a gap on the bottom of the containing element the size of the margin-top. To get past this, apply overflow-y: hidden to your containing element.
302
+
Margin to the left, right, bottom, or top, of an element depending on if the fraction passed is positive or negative. It works for both horizontal and vertical grids but not both.
336
303
337
304
-`$fraction = '1/1'` - Fraction of the container to be offset. Must be a string.
338
305
-`$dir = row` - Direction the grid is going. Should match the block() it's being used on.
339
306
-`$gut = $gutter` - How large the gutter involved is, typically this won't be adjusted, but if you have set the blocks for that row to have different gutters than default, you will need to match that gutter here as well.
340
-
-`$masonry-friendly = false` - Determines whether this offset will work well with masonry friendly grids.
341
307
342
308
```stylus
343
309
.two-elements
@@ -346,23 +312,35 @@ Margin to the left, right, bottom, or top, of an element depending on if the fra
346
312
offset('1/3')
347
313
```
348
314
315
+
349
316
##### `move()`
350
-
Source ordering. Shift elements leftor right by their left position. Not very happy with this implementation: https://github.com/corysimmons/lost/issues/33
317
+
Source ordering. Shift elements left, right, up, or down, by their left or top position by passing a positive or negative fraction.
351
318
352
319
-`$fraction = '1/1'` - Fraction of the container to be shifted. Must be a string.
353
-
-`$spots = 1` - Number of spots to shift. So if you have 1/3 and shift it 2 spots to the right, it will end up on the 3/3 location. Can be negative. You might need to tweak these a bit for various sized objects.
354
-
-`$cycle = 1` - If you have elements of unequal width, you can pass the number of items in the row to the $cycle param to help with the mathz involved.
320
+
-`$dir = row` - Direction the grid is going. Should match the block() it's being used on.
355
321
-`$gut = $gutter` - Adjust the size of the gutter for this movement. Should match the block's $gut.
356
322
-`$output = normal` - Determines the type of output to produce. Accepts 3 options, normal (all the code), init (just the initialization code), and bare (just the left offset).
357
323
358
-
359
324
```stylus
360
325
figure
361
326
block('1/3')
362
327
move('1/3')
363
328
```
364
329
365
330
331
+
##### `masonry-row()`
332
+
Creates a row element for working with JS masonry libraries like Isotope. Assigns a negative margin on each side of this wrapping element.
333
+
334
+
-`$gut = $gutter` - How large the gutter involved is, typically this won't be adjusted and will inherit the global $gutter setting, but it's made available if you want your masonry grid to have a special $gut, it should match your blocks' $guts.
335
+
336
+
```stylus
337
+
section
338
+
masonry-row()
339
+
figure
340
+
block('1/3', $masonry-friendly: true)
341
+
```
342
+
343
+
366
344
## Usage with Node
367
345
-`npm i lost-grid --save-dev`
368
346
@@ -392,9 +370,8 @@ figure
392
370
393
371
394
372
## Browser Support
395
-
-[`calc()` grids](https://webdesign.tutsplus.com/tutorials/calc-grids-are-the-best-grids--cms-22902) are IE9+ with poor support on old Android browsers ([`calc()` browser support](http://caniuse.com/#feat=calc)). With the [calc() Polyfill](https://github.com/closingtag/calc-polyfill) the grid works perfect in IE8 as well.
396
-
- The vertical grids work perfect on IE9+ but even with polyfills elements are taller than they should be on IE8.
397
-
- Nesting works perfect in IE9+ but breaks on IE8.
373
+
-[`calc()` grids](https://webdesign.tutsplus.com/tutorials/calc-grids-are-the-best-grids--cms-22902) work perfect on IE9+ with poor support on old Android browsers ([`calc()` browser support](http://caniuse.com/#feat=calc)).
374
+
- Currently awaiting this [Issue](https://github.com/closingtag/calc-polyfill/issues/10) to be fixed in order to support IE8 (with a polyfill obviously). If it's not fixed rather quickly, I will add support for IE8 manually.
0 commit comments