mixins.less 17.6 KB
Newer Older
1
2
3
//
// Mixins
// --------------------------------------------------
4

5

6
7
// Utilities
// -------------------------
8
9

// Clearfix
10
11
12
13
14
15
16
17
18
19
// Source: http://nicolasgallagher.com/micro-clearfix-hack/
//
// For modern browsers
// 1. The space content is one way to avoid an Opera bug when the
//    contenteditable attribute is included anywhere else in the document.
//    Otherwise it causes space to appear at the top and bottom of elements
//    that are clearfixed.
// 2. The use of `table` rather than `block` is only necessary if using
//    `:before` to contain the top-margins of child elements.
.clear_float() {
20
  &:before,
21
  &:after {
22
23
    content: " "; /* 1 */
    display: table; /* 2 */
24
25
  }
  &:after {
26
    clear: both;
27
  }
28
29
}

Mark Otto's avatar
Mark Otto committed
30
31
32
// Webkit-style focus
.tab-focus() {
  // Default
33
  outline: thin dotted #333;
Mark Otto's avatar
Mark Otto committed
34
35
36
37
38
  // Webkit
  outline: 5px auto -webkit-focus-ring-color;
  outline-offset: -2px;
}

39
// Center-align a block level element
40
.center-block() {
41
  display: block;
42
43
  margin-left: auto;
  margin-right: auto;
44
45
46
}

// Sizing shortcuts
47
.size(@width, @height) {
48
  width: @width;
49
  height: @height;
50
}
51
.square(@size) {
52
  .size(@size, @size);
53
54
}

55
// Placeholder text
Mark Otto's avatar
Mark Otto committed
56
.placeholder(@color: @input-color-placeholder) {
57
  &:-moz-placeholder {
58
59
    color: @color;
  }
60
  &:-ms-input-placeholder {
61
62
    color: @color;
  }
63
  &::-webkit-input-placeholder {
64
65
66
67
    color: @color;
  }
}

Mark Otto's avatar
Mark Otto committed
68
69
70
71
72
73
74
75
// Text overflow
// Requires inline-block or block for proper styling
.text-overflow() {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

76
77
// CSS image replacement
// Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757
78
.hide-text() {
79
80
  font: 0/0 a;
  color: transparent;
81
  text-shadow: none;
82
  background-color: transparent;
83
  border: 0;
84
}
85

86

87
88
89
// FONTS
// --------------------------------------------------

90
#font {
91
92
  #family {
    .serif() {
Mark Otto's avatar
Mark Otto committed
93
      font-family: @font-family-serif;
94
95
    }
    .sans-serif() {
Mark Otto's avatar
Mark Otto committed
96
      font-family: @font-family-sans-serif;
97
98
    }
    .monospace() {
Mark Otto's avatar
Mark Otto committed
99
      font-family: @font-family-monospace;
100
    }
101
  }
102
  .shorthand(@size: @font-size-base, @weight: normal, @lineHeight: @line-height-base) {
103
104
105
106
    font-size: @size;
    font-weight: @weight;
    line-height: @lineHeight;
  }
107
  .serif(@size: @font-size-base, @weight: normal, @lineHeight: @line-height-base) {
108
109
    #font > #family > .serif;
    #font > .shorthand(@size, @weight, @lineHeight);
110
  }
111
  .sans-serif(@size: @font-size-base, @weight: normal, @lineHeight: @line-height-base) {
112
113
114
    #font > #family > .sans-serif;
    #font > .shorthand(@size, @weight, @lineHeight);
  }
115
  .monospace(@size: @font-size-base, @weight: normal, @lineHeight: @line-height-base) {
116
117
    #font > #family > .monospace;
    #font > .shorthand(@size, @weight, @lineHeight);
118
119
120
  }
}

121

122
// FORMS
123
124
// --------------------------------------------------

125
// Block level inputs
126
.input-block-level() {
127
128
129
130
131
  display: block;
  width: 100%;
}


132

133
// Mixin for form field states
134
.formFieldState(@text-color: #555, @border-color: #ccc, @background-color: #f5f5f5) {
135
  // Set the text color
136
  .control-label,
137
138
  .help-block,
  .help-inline {
Mark Otto's avatar
Mark Otto committed
139
    color: @text-color;
140
141
  }
  // Style inputs accordingly
Mark Otto's avatar
Mark Otto committed
142
143
  .checkbox,
  .radio,
144
  input,
145
146
  select,
  textarea {
Mark Otto's avatar
Mark Otto committed
147
    color: @text-color;
148
149
150
151
  }
  input,
  select,
  textarea {
152
    border-color: @border-color;
153
    .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
154
    &:focus {
155
156
      border-color: darken(@border-color, 10%);
      @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%);
157
      .box-shadow(@shadow);
158
159
160
161
162
    }
  }
  // Give a small background color for input-prepend/-append
  .input-prepend .add-on,
  .input-append .add-on {
Mark Otto's avatar
Mark Otto committed
163
    color: @text-color;
164
    background-color: @background-color;
Mark Otto's avatar
Mark Otto committed
165
    border-color: @text-color;
166
167
168
169
170
  }
}



171
172
173
// CSS3 PROPERTIES
// --------------------------------------------------

174
// Single side border-radius
175
.border-top-radius(@radius) {
176
177
  border-top-right-radius: @radius;
   border-top-left-radius: @radius;
178
179
}
.border-right-radius(@radius) {
180
181
  border-bottom-right-radius: @radius;
     border-top-right-radius: @radius;
Mark Otto's avatar
Mark Otto committed
182
183
}
.border-bottom-radius(@radius) {
184
185
  border-bottom-right-radius: @radius;
   border-bottom-left-radius: @radius;
Mark Otto's avatar
Mark Otto committed
186
187
}
.border-left-radius(@radius) {
188
189
  border-bottom-left-radius: @radius;
     border-top-left-radius: @radius;
190
191
}

192
// Drop shadows
Mark Otto's avatar
Mark Otto committed
193
.box-shadow(@shadow) {
194
  -webkit-box-shadow: @shadow; // iOS <4.3 & Android <4.1
195
          box-shadow: @shadow;
196
197
198
}

// Transitions
Mark Otto's avatar
Mark Otto committed
199
200
201
202
203
.transition(@transition) {
  -webkit-transition: @transition;
     -moz-transition: @transition;
       -o-transition: @transition;
          transition: @transition;
204
}
Tunghsiao Liu's avatar
Tunghsiao Liu committed
205
206
207
208
209
210
.transition-delay(@transition-delay) {
  -webkit-transition-delay: @transition-delay;
     -moz-transition-delay: @transition-delay;
       -o-transition-delay: @transition-delay;
          transition-delay: @transition-delay;
}
211

Mark Otto's avatar
Mark Otto committed
212
// Transformations
213
.rotate(@degrees) {
214
215
  -webkit-transform: rotate(@degrees);
     -moz-transform: rotate(@degrees);
Mark Otto's avatar
Mark Otto committed
216
217
      -ms-transform: rotate(@degrees);
       -o-transform: rotate(@degrees);
218
219
          transform: rotate(@degrees);
}
220
221
222
223
224
225
.scale(@ratio) {
  -webkit-transform: scale(@ratio);
     -moz-transform: scale(@ratio);
      -ms-transform: scale(@ratio);
       -o-transform: scale(@ratio);
          transform: scale(@ratio);
226
}
227
.translate(@x, @y) {
Mark Otto's avatar
Mark Otto committed
228
229
230
231
232
233
  -webkit-transform: translate(@x, @y);
     -moz-transform: translate(@x, @y);
      -ms-transform: translate(@x, @y);
       -o-transform: translate(@x, @y);
          transform: translate(@x, @y);
}
234
.skew(@x, @y) {
Mark Otto's avatar
Mark Otto committed
235
236
  -webkit-transform: skew(@x, @y);
     -moz-transform: skew(@x, @y);
237
      -ms-transform: skewX(@x) skewY(@y); // See https://github.com/twitter/bootstrap/issues/4885
Mark Otto's avatar
Mark Otto committed
238
239
       -o-transform: skew(@x, @y);
          transform: skew(@x, @y);
240
  -webkit-backface-visibility: hidden; // See https://github.com/twitter/bootstrap/issues/5319
Mark Otto's avatar
Mark Otto committed
241
}
242
.translate3d(@x, @y, @z) {
243
244
245
246
  -webkit-transform: translate3d(@x, @y, @z);
     -moz-transform: translate3d(@x, @y, @z);
       -o-transform: translate3d(@x, @y, @z);
          transform: translate3d(@x, @y, @z);
247
}
248

249
250
251
252
// Backface visibility
// Prevent browsers from flickering when using CSS 3D transforms.
// Default value is `visible`, but can be changed to `hidden
// See git pull https://github.com/dannykeane/bootstrap.git backface-visibility for examples
253
.backface-visibility(@visibility){
254
	-webkit-backface-visibility: @visibility;
255
256
	   -moz-backface-visibility: @visibility;
	        backface-visibility: @visibility;
257
258
}

259
// Background clipping
Mark Otto's avatar
Mark Otto committed
260
261
262
263
.background-clip(@clip) {
  -webkit-background-clip: @clip;
     -moz-background-clip: @clip;
          background-clip: @clip;
264
265
}

266
// Background sizing
267
.background-size(@size) {
Mark Otto's avatar
Mark Otto committed
268
269
270
271
  -webkit-background-size: @size;
     -moz-background-size: @size;
       -o-background-size: @size;
          background-size: @size;
272
273
}

274
275
276
277
278
279
280
// Box sizing
.box-sizing(@boxmodel) {
  -webkit-box-sizing: @boxmodel;
     -moz-box-sizing: @boxmodel;
          box-sizing: @boxmodel;
}

281
282
283
284
285
// User select
// For selecting text on the page
.user-select(@select) {
  -webkit-user-select: @select;
     -moz-user-select: @select;
Han Lin Yap's avatar
Han Lin Yap committed
286
      -ms-user-select: @select;
287
288
289
290
       -o-user-select: @select;
          user-select: @select;
}

291
// Resize anything
292
.resizable(@direction) {
293
294
295
296
  resize: @direction; // Options: horizontal, vertical, both
  overflow: auto; // Safari fix
}

297
// CSS3 Content Columns
298
299
300
301
302
303
304
.content-columns(@column-count, @column-gap: @grid-gutter-width) {
  -webkit-column-count: @column-count;
     -moz-column-count: @column-count;
          column-count: @column-count;
  -webkit-column-gap: @column-gap;
     -moz-column-gap: @column-gap;
          column-gap: @column-gap;
305
306
}

Synchro's avatar
Synchro committed
307
308
// Optional hyphenation
.hyphens(@mode: auto) {
Mark Otto's avatar
Mark Otto committed
309
  word-wrap: break-word;
Synchro's avatar
Synchro committed
310
311
312
  -webkit-hyphens: @mode;
     -moz-hyphens: @mode;
      -ms-hyphens: @mode;
Synchro's avatar
Synchro committed
313
       -o-hyphens: @mode;
Synchro's avatar
Synchro committed
314
315
316
          hyphens: @mode;
}

317
// Opacity
318
.opacity(@opacity) {
319
  opacity: @opacity / 100;
320
  filter: ~"alpha(opacity=@{opacity})"; // IE8
321
322
323
324
325
326
327
}



// BACKGROUNDS
// --------------------------------------------------

328
329
// Gradients
#gradient {
330
  .horizontal(@startColor: #555, @endColor: #333) {
331
332
    background-color: @endColor;
    background-image: -moz-linear-gradient(left, @startColor, @endColor); // FF 3.6+
333
    background-image: -webkit-gradient(linear, 0 0, 100% 0, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
334
335
    background-image: -webkit-linear-gradient(left, @startColor, @endColor); // Safari 5.1+, Chrome 10+
    background-image: -o-linear-gradient(left, @startColor, @endColor); // Opera 11.10
336
    background-image: linear-gradient(to right, @startColor, @endColor); // Standard, IE10
337
    background-repeat: repeat-x;
338
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",argb(@startColor),argb(@endColor))); // IE9 and down
339
  }
340
  .vertical(@startColor: #555, @endColor: #333) {
341
    background-color: mix(@startColor, @endColor, 60%);
Mark Otto's avatar
Mark Otto committed
342
    background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+
343
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
Mark Otto's avatar
Mark Otto committed
344
345
    background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+
    background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10
346
    background-image: linear-gradient(to bottom, @startColor, @endColor); // Standard, IE10
347
    background-repeat: repeat-x;
348
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@startColor),argb(@endColor))); // IE9 and down
349
  }
350
  .directional(@startColor: #555, @endColor: #333, @deg: 45deg) {
351
352
    background-color: @endColor;
    background-repeat: repeat-x;
353
354
355
    background-image: -moz-linear-gradient(@deg, @startColor, @endColor); // FF 3.6+
    background-image: -webkit-linear-gradient(@deg, @startColor, @endColor); // Safari 5.1+, Chrome 10+
    background-image: -o-linear-gradient(@deg, @startColor, @endColor); // Opera 11.10
356
    background-image: linear-gradient(@deg, @startColor, @endColor); // Standard, IE10
357
  }
sankage's avatar
sankage committed
358
  .vertical-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 50%, @endColor: #c3325f) {
359
    background-color: mix(@midColor, @endColor, 80%);
360
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), color-stop(@colorStop, @midColor), to(@endColor));
sankage's avatar
sankage committed
361
    background-image: -webkit-linear-gradient(@startColor, @midColor @colorStop, @endColor);
362
    background-image: -moz-linear-gradient(top, @startColor, @midColor @colorStop, @endColor);
sankage's avatar
sankage committed
363
364
    background-image: -o-linear-gradient(@startColor, @midColor @colorStop, @endColor);
    background-image: linear-gradient(@startColor, @midColor @colorStop, @endColor);
365
    background-repeat: no-repeat;
366
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@startColor),argb(@endColor))); // IE9 and down, gets no color-stop at all for proper fallback
367
  }
368
  .radial(@innerColor: #555, @outerColor: #333) {
369
370
371
372
    background-color: @outerColor;
    background-image: -webkit-gradient(radial, center center, 0, center center, 460, from(@innerColor), to(@outerColor));
    background-image: -webkit-radial-gradient(circle, @innerColor, @outerColor);
    background-image: -moz-radial-gradient(circle, @innerColor, @outerColor);
373
    background-image: -o-radial-gradient(circle, @innerColor, @outerColor);
374
375
    background-repeat: no-repeat;
  }
376
  .striped(@color: #555, @angle: 45deg) {
Piotrek Okoński's avatar
Piotrek Okoński committed
377
    background-color: @color;
378
379
380
381
382
    background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, rgba(255,255,255,.15)), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, rgba(255,255,255,.15)), color-stop(.75, rgba(255,255,255,.15)), color-stop(.75, transparent), to(transparent));
    background-image: -webkit-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
    background-image: -moz-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
    background-image: -o-linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
    background-image: linear-gradient(@angle, rgba(255,255,255,.15) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.15) 50%, rgba(255,255,255,.15) 75%, transparent 75%, transparent);
Piotrek Okoński's avatar
Piotrek Okoński committed
383
  }
384
}
385
386
// Reset filters for IE
.reset-filter() {
387
  filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)"));
388
}
389

390

391
392
393
394

// COMPONENT MIXINS
// --------------------------------------------------

395
// Horizontal dividers
396
397
// -------------------------
// Dividers (basically an hr) within dropdowns and nav lists
398
.nav-divider(@top: #e5e5e5, @bottom: #fff) {
Jacob Thornton's avatar
Jacob Thornton committed
399
  height: 1px;
400
  margin: ((@line-height-base / 2) - 1) 1px; // 8px 1px
Jacob Thornton's avatar
Jacob Thornton committed
401
  overflow: hidden;
402
403
  background-color: @top;
  border-bottom: 1px solid @bottom;
404
405
}

406
// Button backgrounds
407
// ------------------
Mark Otto's avatar
Mark Otto committed
408
/*.buttonBackground(@startColor, @endColor, @text-color: #fff, @textShadow: 0 -1px 0 rgba(0,0,0,.25)) {
Mark Otto's avatar
Mark Otto committed
409
  color: @text-color;
Mark Otto's avatar
Mark Otto committed
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
  text-shadow: @textShadow;
  #gradient > .vertical(@startColor, @endColor);
  border-color: @endColor @endColor darken(@endColor, 15%);
  border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%);
  .reset-filter();

  // in these cases the gradient won't cover the background, so we override
  &:hover, &:active, &.active, &.disabled, &[disabled] {
    color: @text-color;
    background-color: @endColor;
  }

  // IE8 can't handle box-shadow to show active, so we darken a bit ourselves
  &:active,
  &.active {
    background-color: darken(@endColor, 10%) e("\9");
  }
}*/

// Button backgrounds
// ------------------
.buttonBackground(@background-start, @background-end, @text-color: #fff, @text-shadow: 0 -1px 0 rgba(0,0,0,.25)) {
  color: @text-color;
  text-shadow: @text-shadow;
  #gradient > .vertical(@background-start, @background-end);
  border-color: darken(@background-end, 5%);
436

Mark Otto's avatar
Mark Otto committed
437
  &:hover,
438
439
  &:active,
  &.active {
Mark Otto's avatar
Mark Otto committed
440
    color: @text-color;
Mark Otto's avatar
Mark Otto committed
441
442
443
444
445
446
    background-position: 0 -15px;
    background-color: @background-end;
  }
  &:active,
  &.active {
    background-image: none;
447
448
449
  }
}

Mark Otto's avatar
Mark Otto committed
450

451
452
453
454
// Navbar vertical align
// -------------------------
// Vertically center elements in the navbar.
// Example: an element has a height of 30px, so write out `.navbarVerticalAlign(30px);` to calculate the appropriate top margin.
455
456
.navbarVerticalAlign(@element-height) {
  margin-top: (@navbar-height - @element-height) / 2;
457
458
}

459

460
461
462
463

// Grid System
// -----------

464
// Centered container element
465
466
.container-fixed() {
  margin-right: auto;
Jacob Thornton's avatar
Jacob Thornton committed
467
  margin-left: auto;
468
469
470
  .clearfix();
}

471
472
473
// Make a Grid
// Use .makeRow and .makeColumn to assign semantic layouts grid system behavior
.makeRow() {
Mark Otto's avatar
Mark Otto committed
474
  margin-left: @grid-gutter-width * -1;
475
476
  .clearfix();
}
477
.makeColumn(@columns: 1, @offset: 0) {
478
  float: left;
Mark Otto's avatar
Mark Otto committed
479
480
  margin-left: (@grid-column-width * @offset) + (@grid-gutter-width * (@offset - 1)) + (@grid-gutter-width * 2);
  width: (@grid-column-width * @columns) + (@grid-gutter-width * (@columns - 1));
481
482
483
}

// The Grid
484
485
#grid {

Mark Otto's avatar
Mark Otto committed
486
  .core(@grid-column-width, @grid-gutter-width, @grid-row-width) {
487

Mark Otto's avatar
Mark Otto committed
488
    .spanX(@index) when (@index > 0) {
489
490
491
      (~".span@{index}") { .span(@index); }
      .spanX(@index - 1);
    }
Mark Otto's avatar
Mark Otto committed
492
    .spanX(0) {}
493

Mark Otto's avatar
Mark Otto committed
494
    .offsetX(@index) when (@index > 0) {
495
496
      (~".offset@{index}") { .offset(@index); }
      .offsetX(@index - 1);
497
    }
Mark Otto's avatar
Mark Otto committed
498
    .offsetX(0) {}
499

Mark Otto's avatar
Mark Otto committed
500
501
502

    // Base styles
    .offset(@columns) {
Mark Otto's avatar
Mark Otto committed
503
      margin-left: percentage(@columns / @grid-columns);
504
    }
Mark Otto's avatar
Mark Otto committed
505
    .span(@columns) {
Mark Otto's avatar
Mark Otto committed
506
      width: percentage(@columns / @grid-columns);
507
508
    }

509
    .row {
Mark Otto's avatar
Mark Otto committed
510
      // Negative indent the columns so text lines up
Mark Otto's avatar
Mark Otto committed
511
512
      margin-left: @grid-gutter-width / -2;
      margin-right: @grid-gutter-width / -2;
Mark Otto's avatar
Mark Otto committed
513
      // Clear the floated columns
514
515
516
517
      .clearfix();
    }

    [class*="span"] {
Mark Otto's avatar
Mark Otto committed
518
519
      float: left; // Collapse whitespace
      min-height: 1px; // Prevent empty columns from collapsing
Mark Otto's avatar
Mark Otto committed
520
521
      padding-left: @grid-gutter-width / 2;
      padding-right: @grid-gutter-width / 2;
Mark Otto's avatar
Mark Otto committed
522
      // Proper box-model (padding doesnt' add to width)
523
524
525
      -webkit-box-sizing: border-box;
         -moz-box-sizing: border-box;
              box-sizing: border-box;
526
527
    }

Mark Otto's avatar
Mark Otto committed
528
    // Generate .spanX and .offsetX
Mark Otto's avatar
Mark Otto committed
529
530
    .spanX(@grid-columns);
    .offsetX(@grid-columns);
531
532
533

  }

534

Mark Otto's avatar
Mark Otto committed
535
  .input(@grid-column-width, @grid-gutter-width, @grid-row-width) {
536

Mark Otto's avatar
Mark Otto committed
537
538
    .spanX(@index) when (@index > 0) {
      (~"input.span@{index}, textarea.span@{index}, select.span@{index}, .uneditable-input.span@{index}") { .span(@index); }
539
540
      .spanX(@index - 1);
    }
Mark Otto's avatar
Mark Otto committed
541
    .spanX(0) {}
Mark Otto's avatar
Mark Otto committed
542

Mark Otto's avatar
Mark Otto committed
543
544
545
546
547
    .offsetX(@index) when (@index > 0) {
      (~"input.offset@{index}, textarea.offset@{index}, select.offset@{index}, uneditable-input.offset@{index}") { .offset(@index); }
      .offsetX(@index - 1);
    }
    .offsetX(0) {}
Mark Otto's avatar
Mark Otto committed
548

Mark Otto's avatar
Mark Otto committed
549
    .span(@columns) {
Mark Otto's avatar
Mark Otto committed
550
      // TODO: Figure out how to add this back behind a class
Mark Otto's avatar
Mark Otto committed
551
      // Part 1: Since inputs require padding *and* margin, we subtract the grid gutter width, as a percent of the row, from the default column width.
Mark Otto's avatar
Mark Otto committed
552
      //width: percentage(@columns / @grid-columns) - percentage(@grid-gutter-width / @grid-row-width);
Mark Otto's avatar
Mark Otto committed
553
      // Part 2: That subtracted width then gets split in half and added to the left and right margins.
Mark Otto's avatar
Mark Otto committed
554
555
      // margin-left: percentage((@grid-gutter-width / 2) / @grid-row-width);
      // margin-right: percentage((@grid-gutter-width / 2) / @grid-row-width);
556
557
    }

Mark Otto's avatar
Mark Otto committed
558
559
    .offset(@columns) {
      // Take the normal offset margin and add an extra gutter's worth.
Mark Otto's avatar
Mark Otto committed
560
      margin-left: percentage(@columns / @grid-columns) + percentage((@grid-gutter-width / 2) / @grid-row-width);
561
562
    }

Mark Otto's avatar
Mark Otto committed
563
    // Generate .spanX and .offsetX
Mark Otto's avatar
Mark Otto committed
564
565
    .spanX(@grid-columns);
    .offsetX(@grid-columns);
566
567
568
569

  }


570
}