-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.less
More file actions
248 lines (226 loc) · 6.07 KB
/
helpers.less
File metadata and controls
248 lines (226 loc) · 6.07 KB
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
@img_path: '/img';
@sprite: "@{img_path}/solidsprite.png";
@sprite_grid: 30px;
// Replaces element's content with a given section of sprite
//
// @pos - Icon's position on sprite
// @w - Icon's width
// @h - Icon's height
// @display - CSS `display` value, defaults to `block`
//
// Compatibility untested
.sprite (@pos, @w, @h, @display: block) {
background: url("@{sprite}") 0 -(@pos * @sprite_grid) no-repeat transparent;
display: @display;
height: @h * 1px;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
width: @w * 1px;
}
// Forces layout for parent of floated elements
//
// Compatibility untested
.clearfix {
display: block;
zoom: 1;
&:after {
clear: both;
content: ".";
display: block;
height: 0;
visibility: hidden;
}
}
// https://developer.mozilla.org/en-US/docs/CSS/backface-visibility
//
// @type - `visible` or `hidden`
//
// Compatibility untested
.backface-visibility (@type) {
-moz-backface-visibility: @type;
-webkit-backface-visibility: @type;
backface-visibility: @type;
}
// https://developer.mozilla.org/en-US/docs/CSS/linear-gradient
//
// @gradient - values for image to be created
//
// Compatibility untested
.linear-gradient (@gradient: top~"," #fff~"," #000) {
background: -webkit-linear-gradient(@arguments);
background: -moz-linear-gradient(@arguments);
background: -ms-linear-gradient(@arguments);
background: -o-linear-gradient(@arguments);
background: linear-gradient(@arguments);
}
// Creates a linear gradient for IE6-8
//
// @start - Starting color
// @end - Ending color
// @gradient - 0 = vertical gradient, 1 = horizontal gradient
//
// Compatibility IE6-8
.ms-linear-gradient (@start, @end, @gradient: 0) {
filter: ~"progid:DXImageTransform.Microsoft.gradient( startColorstr='@{start}', endColorstr='@{end}',GradientType='@{gradient}' )";
}
// https://developer.mozilla.org/en-US/docs/CSS/radial-gradient
//
// @gradient - values for image to be created
//
// Compatibility untested
.radial-gradient (@gradient: center~"," ellipse~"," #fff~"," #000) {
background: -webkit-radial-gradient(@arguments);
background: -moz-radial-gradient(@arguments);
background: -ms-radial-gradient(@arguments);
background: -o-radial-gradient(@arguments);
background: radial-gradient(@arguments);
}
// https://developer.mozilla.org/en-US/docs/CSS/border-radius
//
// @radius - Radii
//
// Compatibility untested
.border-radius (@radius: 0) {
-moz-border-radius: @arguments;
-webkit-border-radius: @arguments;
border-radius: @arguments;
}
// https://developer.mozilla.org/en-US/docs/CSS/box-sizing
//
// @val - content-box, padding-box, or border-box
//
// Compatibility untested
.box-sizing (@val) {
-moz-box-sizing: @val;
-webkit-box-sizing: @val;
box-sizing: @val;
}
// https://developer.mozilla.org/en-US/docs/CSS/box-shadow
//
// @properties - box shadow properties
//
// Compatibility untested
.box-shadow (@properties) {
-moz-box-shadow: @properties;
-webkit-box-shadow: @properties;
box-shadow: @properties;
}
// Resets box shadow to its default state, that is, as if it was never applied
//
// Compatibility untested
.box-shadow-remove {
-moz-box-shadow: 0 0 0 0 transparent;
-webkit-box-shadow: 0 0 0 0 transparent;
box-shadow: 0 0 0 0 transparent;
}
// Styles element as though it was empty
//
// Compatibility untested
.empty-block {
display: block;
content: '';
height: 0;
width: 0;
}
// Replaces element with section of @img. Background url is determined by set @img_path + @img.
// For example. @img_path: "/img" and @img: "sprite.png", results in "/img/sprite.png"
//
// @w - section width
// @h - section height
// @img - filename to use as background image
// @x - horizontal background-position
// @y - vertical background-position
//
// Compatibility untested
.img-block (@w, @h, @img, @x: 0, @y: 0) {
background: url('@{img_path}/@{img}') @x @y no-repeat transparent;
display: block;
height: @h;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
width: @w;
}
// https://developer.mozilla.org/en-US/docs/CSS/opacity
//
// @alpha - alpha channel opacity
//
// Compatibility untested
.opacity (@alpha) {
-moz-opacity: @alpha;
filter: alpha(opacity=@alpha);
opacity: @alpha;
}
// https://developer.mozilla.org/en-US/docs/CSS/perspective
//
// @val - number representing length away from the user's z=0 plane.
//
// Compatibility untested
.perspective (@val) {
-moz-perspective: @val;
-webkit-perspective: @val;
perspective: @val;
}
// Clips element's text at one single line
//
// @type - value for text-overflow, defaults to 'ellipsis'
//
// Compatibility untested
.text-overflow (@type: ellipsis) {
display: block;
overflow: hidden;
text-overflow: @type;
white-space: nowrap;
}
// https://developer.mozilla.org/en-US/docs/CSS/transition
//
// @property - name of properties to which transition will be applied
// @dur - transition's duration in seconds
// @timing - timing function to be used for transition
//
// Compatibility untested
.transition (@property, @dur, @timing) {
-webkit-transition-property: @property;
-webkit-transition-duration: @dur;
-webkit-transition-timing-function: @timing;
-moz-transition-property: @property;
-moz-transition-duration: @dur;
-moz-transition-timing-function: @timing;
-o-transition-property: @property;
-o-transition-duration: @dur;
-o-transition-timing-function: @timing;
transition-property: @property;
transition-duration: @dur;
transition-timing-function: @timing;
}
// https://developer.mozilla.org/en-US/docs/CSS/transform
//
// @func - CSS transform function
//
// Compatibility untested
.transform (@func) {
-moz-transform: @func;
-webkit-transform: @func;
transform: @func;
}
// https://developer.mozilla.org/en-US/docs/CSS/transform-origin
//
// @origin - origin offset
//
// Compatibility untested
.transform-origin (@origin) {
-moz-transform-origin: @origin;
-webkit-transform-origin: @origin;
transform-origin: @origin;
}
// https://developer.mozilla.org/en-US/docs/CSS/transform-style
//
// @style - `flat` or `preserve-3d`
//
// Compatibility unstested
.transform-style (@style) {
-moz-transform-style: @style;
-webkit-transform-style: @style;
transform-style: @style;
}