-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblock-grid.scss
74 lines (61 loc) · 1.88 KB
/
block-grid.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
// block grid mixin for Bootstrap 3
// based on http://www.nodenerd.com/using-foundations-block-grid-mixin-within-bootstrap-css-framework-updated
// variables - you can set them here, or @import 'bootstrap/variables';
$grid-gutter-width: 30px;
// mixin to create the grid container
@mixin make-block-grid-container {
@include clearfix;
margin-left: ($grid-gutter-width / -2);
margin-right: ($grid-gutter-width / -2);
> * {
margin-bottom: $grid-gutter-width;
min-height: 1px;
padding-left: ($grid-gutter-width / 2);
padding-right: ($grid-gutter-width / 2);
position: relative;
}
}
// mixin used below to create the grid elements below
@mixin create-grid($blocks) {
float: left;
width: percentage(1 / $blocks);
&:nth-of-type(1n) {
clear: none;
}
&:nth-of-type(#{$blocks}n+1) {
clear: both;
}
}
// individual block grids
@mixin make-xs-block-grid ($blocks) {
@include create-grid($blocks);
}
@mixin make-sm-block-grid ($blocks) {
// @media (min-width: ($screen-sm-min)){ // you can use this built in Bootstrap breakpoint variable instead
@media (min-width: 768px) {
@include create-grid($blocks);
}
}
@mixin make-md-block-grid ($blocks) {
// @media (min-width: ($screen-md-min)){ // you can use this built in Bootstrap breakpoint variable instead
@media (min-width: 992px) {
@include create-grid($blocks);
}
}
@mixin make-lg-block-grid ($blocks) {
// @media (min-width: ($screen-lg-min)){ // you can use this built in Bootstrap breakpoint variable instead
@media (min-width: 1200px) {
@include create-grid($blocks);
}
}
// block-grid shorthand mixin
// usage: @include make-block-grid(1,2,4,6)
@mixin make-block-grid ($cols-xs, $cols-sm, $cols-md, $cols-lg) {
@include make-block-grid-container();
> * {
@include make-xs-block-grid($cols-xs);
@include make-sm-block-grid($cols-sm);
@include make-md-block-grid($cols-md);
@include make-lg-block-grid($cols-lg);
}
}