|
a |
|
b/docs/_sass/_gridism.scss |
|
|
1 |
/* |
|
|
2 |
* Gridism |
|
|
3 |
* A simple, responsive, and handy CSS grid by @cobyism |
|
|
4 |
* https://github.com/cobyism/gridism |
|
|
5 |
*/ |
|
|
6 |
|
|
|
7 |
/* Preserve some sanity */ |
|
|
8 |
.grid, |
|
|
9 |
.unit { |
|
|
10 |
-webkit-box-sizing: border-box; |
|
|
11 |
-moz-box-sizing: border-box; |
|
|
12 |
box-sizing: border-box; |
|
|
13 |
} |
|
|
14 |
|
|
|
15 |
/* Set up some rules to govern the grid */ |
|
|
16 |
.grid { |
|
|
17 |
display: block; |
|
|
18 |
clear: both; |
|
|
19 |
} |
|
|
20 |
.grid .unit { |
|
|
21 |
float: left; |
|
|
22 |
width: 100%; |
|
|
23 |
padding: 10px; |
|
|
24 |
} |
|
|
25 |
|
|
|
26 |
/* This ensures the outer gutters are equal to the (doubled) inner gutters. */ |
|
|
27 |
.grid .unit:first-child { padding-left: 20px; } |
|
|
28 |
.grid .unit:last-child { padding-right: 20px; } |
|
|
29 |
|
|
|
30 |
/* Nested grids already have padding though, so let's nuke it */ |
|
|
31 |
.unit .unit:first-child { padding-left: 0; } |
|
|
32 |
.unit .unit:last-child { padding-right: 0; } |
|
|
33 |
.unit .grid:first-child > .unit { padding-top: 0; } |
|
|
34 |
.unit .grid:last-child > .unit { padding-bottom: 0; } |
|
|
35 |
|
|
|
36 |
/* Let people nuke the gutters/padding completely in a couple of ways */ |
|
|
37 |
.no-gutters .unit, |
|
|
38 |
.unit.no-gutters { |
|
|
39 |
padding: 0 !important; |
|
|
40 |
} |
|
|
41 |
|
|
|
42 |
/* Wrapping at a maximum width is optional */ |
|
|
43 |
.wrap .grid, |
|
|
44 |
.grid.wrap { |
|
|
45 |
max-width: 978px; |
|
|
46 |
margin: 0 auto; |
|
|
47 |
} |
|
|
48 |
|
|
|
49 |
/* Width classes also have shorthand versions numbered as fractions |
|
|
50 |
* For example: for a grid unit 1/3 (one third) of the parent width, |
|
|
51 |
* simply apply class="w-1-3" to the element. */ |
|
|
52 |
.grid .whole, .grid .w-1-1 { width: 100%; } |
|
|
53 |
.grid .half, .grid .w-1-2 { width: 50%; } |
|
|
54 |
.grid .one-third, .grid .w-1-3 { width: 33.3332%; } |
|
|
55 |
.grid .two-thirds, .grid .w-2-3 { width: 66.6665%; } |
|
|
56 |
.grid .one-quarter, |
|
|
57 |
.grid .one-fourth, .grid .w-1-4 { width: 25%; } |
|
|
58 |
.grid .three-quarters, |
|
|
59 |
.grid .three-fourths, .grid .w-3-4 { width: 75%; } |
|
|
60 |
.grid .one-fifth, .grid .w-1-5 { width: 20%; } |
|
|
61 |
.grid .two-fifths, .grid .w-2-5 { width: 40%; } |
|
|
62 |
.grid .three-fifths, .grid .w-3-5 { width: 60%; } |
|
|
63 |
.grid .four-fifths, .grid .w-4-5 { width: 80%; } |
|
|
64 |
.grid .golden-small, .grid .w-g-s { width: 38.2716%; } /* Golden section: smaller piece */ |
|
|
65 |
.grid .golden-large, .grid .w-g-l { width: 61.7283%; } /* Golden section: larger piece */ |
|
|
66 |
|
|
|
67 |
/* Clearfix after every .grid */ |
|
|
68 |
.grid { |
|
|
69 |
*zoom: 1; |
|
|
70 |
} |
|
|
71 |
.grid:before, .grid:after { |
|
|
72 |
display: table; |
|
|
73 |
content: ""; |
|
|
74 |
line-height: 0; |
|
|
75 |
} |
|
|
76 |
.grid:after { |
|
|
77 |
clear: both; |
|
|
78 |
} |
|
|
79 |
|
|
|
80 |
/* Utility classes */ |
|
|
81 |
.align-center { text-align: center; } |
|
|
82 |
.align-left { text-align: left; } |
|
|
83 |
.align-right { text-align: right; } |
|
|
84 |
.pull-left { float: left; } |
|
|
85 |
.pull-right { float: right; } |
|
|
86 |
|
|
|
87 |
/* A property for a better rendering of images in units: in |
|
|
88 |
this way bigger pictures are just resized if the unit |
|
|
89 |
becomes smaller */ |
|
|
90 |
.unit img { |
|
|
91 |
max-width: 100%; |
|
|
92 |
height: auto; |
|
|
93 |
} |
|
|
94 |
|
|
|
95 |
/* Responsive Stuff */ |
|
|
96 |
@media screen and (max-width: 568px) { |
|
|
97 |
/* Stack anything that isn't full-width on smaller screens |
|
|
98 |
and doesn't provide the no-stacking-on-mobiles class */ |
|
|
99 |
.grid:not(.no-stacking-on-mobiles) > .unit { |
|
|
100 |
width: 100% !important; |
|
|
101 |
padding-left: 20px; |
|
|
102 |
padding-right: 20px; |
|
|
103 |
} |
|
|
104 |
.unit .grid .unit { |
|
|
105 |
padding-left: 0px; |
|
|
106 |
padding-right: 0px; |
|
|
107 |
} |
|
|
108 |
|
|
|
109 |
/* Sometimes, you just want to be different on small screens */ |
|
|
110 |
.center-on-mobiles { |
|
|
111 |
text-align: center !important; |
|
|
112 |
} |
|
|
113 |
.hide-on-mobiles { |
|
|
114 |
display: none !important; |
|
|
115 |
} |
|
|
116 |
} |
|
|
117 |
|
|
|
118 |
/* Expand the wrap a bit further on larger screens */ |
|
|
119 |
@media screen and (min-width: 1180px) { |
|
|
120 |
.wider .grid, |
|
|
121 |
.grid.wider { |
|
|
122 |
max-width: 1180px; |
|
|
123 |
margin: 0 auto; |
|
|
124 |
} |
|
|
125 |
} |