This repository was archived by the owner on Nov 9, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +98
-0
lines changed Expand file tree Collapse file tree 3 files changed +98
-0
lines changed Original file line number Diff line number Diff line change @@ -2,3 +2,35 @@ grid-layout
2
2
===========
3
3
4
4
scss mixin for creating grid layouts
5
+
6
+ Docs
7
+ ----
8
+
9
+ ``` scss
10
+ grid-layout($columns : 24 , $sitewidth : 960 , $margin : 20 )
11
+ ```
12
+
13
+ Usage Examples
14
+ --------------
15
+
16
+ Plain:
17
+ ```scss
18
+ @include grid-layout ();
19
+ ```
20
+
21
+ Advanced:
22
+ ``` scss
23
+ /*
24
+ generates a grid that has 24 columns with a 10px
25
+ margin at 1020px width
26
+ */
27
+
28
+ @include grid-layout (24 , 1020 , 10 );
29
+ ```
30
+
31
+ Installation
32
+ ------------
33
+
34
+ ``` shell
35
+ bower install markusfalk/grid-layout
36
+ ```
Original file line number Diff line number Diff line change
1
+ // $sitewidth and $margin in px
2
+ @mixin mf-layout ($columns : 24 , $sitewidth : 960 , $margin : 20 ) {
3
+ $col-margin : percentage ($margin / $sitewidth );
4
+
5
+ .cols#{$columns } {
6
+ margin : 0 ;
7
+
8
+ & :after {
9
+ clear : both ;
10
+ content : " " ;
11
+ display : block ;
12
+ font-size : 0 ;
13
+ visibility : hidden ;
14
+ }
15
+
16
+ > .col {
17
+ float : left ;
18
+ margin-left : $col-margin ;
19
+ min-height : 1px ;
20
+
21
+ & :first-child {
22
+ margin-left : 0 ;
23
+ }
24
+ }
25
+ }
26
+
27
+ $i : $columns ;
28
+
29
+ @while $i > 0 {
30
+ $width : (100% / $columns ) * $i ;
31
+ $margin : ($col-margin / $columns ) * $i ;
32
+
33
+ .c#{$i } of#{$columns } {
34
+ width : $width + $margin - $col-margin ;
35
+ }
36
+
37
+ .cols#{$columns } .col.offset#{$i } of#{$columns } {
38
+ margin-left : $width + $margin + $col-margin ;
39
+ }
40
+
41
+ .cols#{$columns } .col.offset#{$i } of#{$columns } :first-child {
42
+ margin-left : $width + $margin ;
43
+ }
44
+
45
+ $i : $i - 1 ;
46
+ }
47
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " grid-layout" ,
3
+ "version" : " 1.0.0" ,
4
+ "homepage" : " https://github.com/markusfalk/grid-layout" ,
5
+ "authors" : [
6
+
7
+ ],
8
+ "description" : " scss mixin for creating grid layouts" ,
9
+ "main" : " _grid-layout.scss" ,
10
+ "keywords" : [
11
+ " grid" ,
12
+ " mixin" ,
13
+ " scss"
14
+ ],
15
+ "license" : " MIT" ,
16
+ "ignore" : [
17
+ " *.html"
18
+ ]
19
+ }
You can’t perform that action at this time.
0 commit comments