forked from m6tt/HelpLess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhlgrid-plugin.less
253 lines (236 loc) · 7.17 KB
/
hlgrid-plugin.less
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
/* --------------------------------------------------------------------------------------
* HelpLess is released under the MIT license.
*
* Copyright (C) 2011 by Matt Woodfield
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify,
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to the
* following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies
* or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* --------------------------------------------------------------------------------------
*
* HelpLess - A lot of Less help
* --------------------------------------------------------------------------------------
*
* @What is it:
* HelpLess is a Helper Library for the brilliant LESS dynamic stylesheet language.
* Read more about LESS: http://lesscss.org/
*
* I have tried to make HelpLess as all-encompasing as possible with support for dynamic
* grids and page starter themes as well as all the css3 features I could think of.
* Unlike other libraries, HelpLess has an invisible footprint until you call a mixin
* so if you import HelpLess but don't use it, it will not increase your compiled file size
*
* @How to use:
* Import helpless.less into your main style.less file.
*
* @Author:
* Matt Woodfield - @m6tt
*
* @Reference:
* ------------------------------------------------------------------------------
* GRID => syntax
* ------------------------------------------------------------------------------
* - #hlgrid => namespace, do not call directly, use .make or one of the predefined grid makers
* - .make => #hlgrid > .make(width, colNumber, gutterWidth)
* - .1200 => #hlgrid > .1200();
* - .1120 => #hlgrid > .1120();
* - .1040 => #hlgrid > 1040();
* - .960 => #hlgrid > 960();
* - .880 => #hlgrid > .880();
* - .800 => #hlgrid > .800();
* - .720 => #hlgrid > .720();
* - .640 => #hlgrid > .640();
* - .560 => #hlgrid > .560();
* - .480 => #hlgrid > .480();
* - .400 => #hlgrid > .400();
* - .320 => #hlgrid > .320();
* - .240 => #hlgrid > .240();
* - .row => #hlgrid > .row();
* - .col => #hlgrid > .col(colSpan);
*
/************************************
* HelpLess grid System
************************************/
#hlgrid {
/************************************
* Make
*
* @what?: Defines the base variables needed
* for the HelpLess grid system.
*
* @params: @width, default = 960
* @colnum, default = 16
* @colgutter, default = 10
*
************************************/
.make(@width: 960, @colnum: 16, @colgutter: 10) {
width: 0px + @width;
@col-width: 100% / @colnum;
@col-gutter-percent: 0% + ((@colgutter / @width) * 100);
}
/************************************
* 1200
*
* @what?: Predefined grid maker
*
************************************/
.1200() {
.make(1200);
}
/************************************
* 1120
*
* @what?: Predefined grid maker
*
************************************/
.1120() {
.make(1120);
}
/************************************
* 1040
*
* @what?: Predefined grid maker
*
************************************/
.1040() {
.make(1040);
}
/************************************
* 960
*
* @what?: Predefined grid maker
*
************************************/
.960() {
.make(960);
}
/************************************
* 880
*
* @what?: Predefined grid maker
*
************************************/
.880() {
.make(880);
}
/************************************
* 800
*
* @what?: Predefined grid maker
*
************************************/
.800() {
.make(800);
}
/************************************
* 720
*
* @what?: Predefined grid maker
*
************************************/
.720() {
.make(720);
}
/************************************
* 640
*
* @what?: Predefined grid maker
*
************************************/
.640() {
.make(640);
}
/************************************
* 560
*
* @what?: Predefined grid maker
*
************************************/
.560() {
.make(560);
}
/************************************
* 480
*
* @what?: Predefined grid maker
*
************************************/
.480() {
.make(480);
}
/************************************
* 400
*
* @what?: Predefined grid maker
*
************************************/
.400() {
.make(400);
}
/************************************
* 320
*
* @what?: Predefined grid maker
*
************************************/
.320() {
.make(320);
}
/************************************
* 240
*
* @what?: Predefined grid maker
*
************************************/
.240() {
.make(240);
}
/************************************
* Row
*
* @what?: Defines an element as a row.
* clears all clearfixes all columns
* directly inside.
*
************************************/
.row() {
.clearfix();
display: block;
width: 100%;
overflow-y: visible;
margin-left: -(@col-gutter-percent / 2);
}
/************************************
* Col
*
* @what?: Defines an element as a column.
* Sets the width depending on the
* supplied arguments and the width
* set in .grid()
*
* @params: @colSpan, default = 1
*
************************************/
.col(@colSpan: 1) {
float: left;
display: block;
min-width: @col-width * @colSpan;
padding: 0 0 0 @col-gutter-percent !important;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
}