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

5

6
7
8
9
// UTILITY MIXINS
// --------------------------------------------------

// Clearfix
Mark Otto's avatar
Mark Otto committed
10
// --------
11
// For clearing floats like a boss h5bp.com/q
12
.clearfix() {
13
  &:before,
14
  &:after {
15
16
    display: table;
    content: "";
17
18
19
    // Fixes Opera/contenteditable bug:
    // http://nicolasgallagher.com/micro-clearfix-hack/#comment-36952
    line-height: 0;
20
21
  }
  &:after {
22
    clear: both;
23
  }
24
25
}

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

36
// Center-align a block level element
Mark Otto's avatar
Mark Otto committed
37
// ----------------------------------
38
.center-block() {
39
  display: block;
40
41
  margin-left: auto;
  margin-right: auto;
42
43
44
}

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

54
55
// Placeholder text
// -------------------------
56
.placeholder(@color: @placeholderText) {
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
76
// Text overflow
// -------------------------
// Requires inline-block or block for proper styling
.text-overflow() {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

88

89
90
91
// FONTS
// --------------------------------------------------

92
#font {
93
94
  #family {
    .serif() {
95
      font-family: @serifFontFamily;
96
97
    }
    .sans-serif() {
98
      font-family: @sansFontFamily;
99
100
    }
    .monospace() {
101
      font-family: @monoFontFamily;
102
    }
103
  }
104
  .shorthand(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
105
106
107
108
    font-size: @size;
    font-weight: @weight;
    line-height: @lineHeight;
  }
109
110
111
  .serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
    #font > #family > .serif;
    #font > .shorthand(@size, @weight, @lineHeight);
112
  }
113
114
115
116
117
118
119
  .sans-serif(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
    #font > #family > .sans-serif;
    #font > .shorthand(@size, @weight, @lineHeight);
  }
  .monospace(@size: @baseFontSize, @weight: normal, @lineHeight: @baseLineHeight) {
    #font > #family > .monospace;
    #font > .shorthand(@size, @weight, @lineHeight);
120
121
122
  }
}

123

124
// FORMS
125
126
// --------------------------------------------------

127
// Block level inputs
128
.input-block-level() {
129
130
  display: block;
  width: 100%;
131
  min-height: @inputHeight; // Make inputs at least the height of their button counterpart (base line-height + padding + border)
132
  .box-sizing(border-box); // Makes inputs behave like true block-level elements
133
134
135
}


136

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



175
176
177
// CSS3 PROPERTIES
// --------------------------------------------------

178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
// Single Corner Border Radius
.border-top-left-radius(@radius) {
  -webkit-border-top-left-radius: @radius;
      -moz-border-radius-topleft: @radius;
          border-top-left-radius: @radius;
}
.border-top-right-radius(@radius) {
  -webkit-border-top-right-radius: @radius;
      -moz-border-radius-topright: @radius;
          border-top-right-radius: @radius;
}
.border-bottom-right-radius(@radius) {
  -webkit-border-bottom-right-radius: @radius;
      -moz-border-radius-bottomright: @radius;
          border-bottom-right-radius: @radius;
}
Mark Otto's avatar
Mark Otto committed
194
195
196
197
198
.border-bottom-left-radius(@radius) {
  -webkit-border-bottom-left-radius: @radius;
      -moz-border-radius-bottomleft: @radius;
          border-bottom-left-radius: @radius;
}
199
200
201
202
203
204
205
206

// Single Side Border Radius
.border-top-radius(@radius) {
  .border-top-right-radius(@radius);
  .border-top-left-radius(@radius);
}
.border-right-radius(@radius) {
  .border-top-right-radius(@radius);
Mark Otto's avatar
Mark Otto committed
207
208
209
210
211
212
213
214
215
  .border-bottom-right-radius(@radius);
}
.border-bottom-radius(@radius) {
  .border-bottom-right-radius(@radius);
  .border-bottom-left-radius(@radius);
}
.border-left-radius(@radius) {
  .border-top-left-radius(@radius);
  .border-bottom-left-radius(@radius);
216
217
}

218
// Drop shadows
Mark Otto's avatar
Mark Otto committed
219
.box-shadow(@shadow) {
220
221
222
  -webkit-box-shadow: @shadow;
     -moz-box-shadow: @shadow;
          box-shadow: @shadow;
223
224
225
}

// Transitions
Mark Otto's avatar
Mark Otto committed
226
227
228
229
230
.transition(@transition) {
  -webkit-transition: @transition;
     -moz-transition: @transition;
       -o-transition: @transition;
          transition: @transition;
231
}
Tunghsiao Liu's avatar
Tunghsiao Liu committed
232
233
234
235
236
237
.transition-delay(@transition-delay) {
  -webkit-transition-delay: @transition-delay;
     -moz-transition-delay: @transition-delay;
       -o-transition-delay: @transition-delay;
          transition-delay: @transition-delay;
}
238

Mark Otto's avatar
Mark Otto committed
239
// Transformations
240
.rotate(@degrees) {
241
242
  -webkit-transform: rotate(@degrees);
     -moz-transform: rotate(@degrees);
Mark Otto's avatar
Mark Otto committed
243
244
      -ms-transform: rotate(@degrees);
       -o-transform: rotate(@degrees);
245
246
          transform: rotate(@degrees);
}
247
248
249
250
251
252
.scale(@ratio) {
  -webkit-transform: scale(@ratio);
     -moz-transform: scale(@ratio);
      -ms-transform: scale(@ratio);
       -o-transform: scale(@ratio);
          transform: scale(@ratio);
253
}
254
.translate(@x, @y) {
Mark Otto's avatar
Mark Otto committed
255
256
257
258
259
260
  -webkit-transform: translate(@x, @y);
     -moz-transform: translate(@x, @y);
      -ms-transform: translate(@x, @y);
       -o-transform: translate(@x, @y);
          transform: translate(@x, @y);
}
261
.skew(@x, @y) {
Mark Otto's avatar
Mark Otto committed
262
263
  -webkit-transform: skew(@x, @y);
     -moz-transform: skew(@x, @y);
264
      -ms-transform: skewX(@x) skewY(@y); // See https://github.com/twitter/bootstrap/issues/4885
Mark Otto's avatar
Mark Otto committed
265
266
267
       -o-transform: skew(@x, @y);
          transform: skew(@x, @y);
}
268
.translate3d(@x, @y, @z) {
269
270
271
272
  -webkit-transform: translate3d(@x, @y, @z);
     -moz-transform: translate3d(@x, @y, @z);
       -o-transform: translate3d(@x, @y, @z);
          transform: translate3d(@x, @y, @z);
273
}
274

275
276
277
278
// 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
279
.backface-visibility(@visibility){
280
	-webkit-backface-visibility: @visibility;
281
282
	   -moz-backface-visibility: @visibility;
	        backface-visibility: @visibility;
283
284
}

285
// Background clipping
Mark Otto's avatar
Mark Otto committed
286
287
288
289
.background-clip(@clip) {
  -webkit-background-clip: @clip;
     -moz-background-clip: @clip;
          background-clip: @clip;
290
291
}

292
// Background sizing
293
.background-size(@size) {
Mark Otto's avatar
Mark Otto committed
294
295
296
297
  -webkit-background-size: @size;
     -moz-background-size: @size;
       -o-background-size: @size;
          background-size: @size;
298
299
}

300
301
302
303
304
305
306
// Box sizing
.box-sizing(@boxmodel) {
  -webkit-box-sizing: @boxmodel;
     -moz-box-sizing: @boxmodel;
          box-sizing: @boxmodel;
}

307
308
309
310
311
// 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
312
      -ms-user-select: @select;
313
314
315
316
       -o-user-select: @select;
          user-select: @select;
}

317
// Resize anything
318
.resizable(@direction) {
319
320
321
322
  resize: @direction; // Options: horizontal, vertical, both
  overflow: auto; // Safari fix
}

323
// CSS3 Content Columns
324
.content-columns(@columnCount, @columnGap: @gridGutterWidth) {
325
326
  -webkit-column-count: @columnCount;
     -moz-column-count: @columnCount;
327
328
          column-count: @columnCount;
  -webkit-column-gap: @columnGap;
329
     -moz-column-gap: @columnGap;
330
          column-gap: @columnGap;
331
332
}

Synchro's avatar
Synchro committed
333
334
// Optional hyphenation
.hyphens(@mode: auto) {
Mark Otto's avatar
Mark Otto committed
335
  word-wrap: break-word;
Synchro's avatar
Synchro committed
336
337
338
  -webkit-hyphens: @mode;
     -moz-hyphens: @mode;
      -ms-hyphens: @mode;
Synchro's avatar
Synchro committed
339
       -o-hyphens: @mode;
Synchro's avatar
Synchro committed
340
341
342
          hyphens: @mode;
}

343
// Opacity
344
.opacity(@opacity) {
345
  opacity: @opacity / 100;
346
  filter: ~"alpha(opacity=@{opacity})"; // IE8
347
348
349
350
351
352
353
}



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

Mark Otto's avatar
Mark Otto committed
354
// Gradient Bar Colors for buttons and alerts
355
356
357
.gradientBar(@primaryColor, @secondaryColor, @textColor: #fff, @textShadow: 0 -1px 0 rgba(0,0,0,.25)) {
  color: @textColor;
  text-shadow: @textShadow;
358
  #gradient > .vertical(@primaryColor, @secondaryColor);
359
360
361
362
  border-color: @secondaryColor @secondaryColor darken(@secondaryColor, 15%);
  border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%);
}

363
364
// Gradients
#gradient {
365
  .horizontal(@startColor: #555, @endColor: #333) {
366
367
    background-color: @endColor;
    background-image: -moz-linear-gradient(left, @startColor, @endColor); // FF 3.6+
368
    background-image: -webkit-gradient(linear, 0 0, 100% 0, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
369
370
    background-image: -webkit-linear-gradient(left, @startColor, @endColor); // Safari 5.1+, Chrome 10+
    background-image: -o-linear-gradient(left, @startColor, @endColor); // Opera 11.10
371
    background-image: linear-gradient(to right, @startColor, @endColor); // Standard, IE10
372
    background-repeat: repeat-x;
373
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",argb(@startColor),argb(@endColor))); // IE9 and down
374
  }
375
  .vertical(@startColor: #555, @endColor: #333) {
376
    background-color: mix(@startColor, @endColor, 60%);
Mark Otto's avatar
Mark Otto committed
377
    background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+
378
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+
Mark Otto's avatar
Mark Otto committed
379
380
    background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+
    background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10
381
    background-image: linear-gradient(to bottom, @startColor, @endColor); // Standard, IE10
382
    background-repeat: repeat-x;
383
    filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",argb(@startColor),argb(@endColor))); // IE9 and down
384
  }
385
  .directional(@startColor: #555, @endColor: #333, @deg: 45deg) {
386
387
    background-color: @endColor;
    background-repeat: repeat-x;
388
389
390
    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
391
    background-image: linear-gradient(@deg, @startColor, @endColor); // Standard, IE10
392
  }
sankage's avatar
sankage committed
393
  .vertical-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 50%, @endColor: #c3325f) {
394
    background-color: mix(@midColor, @endColor, 80%);
395
    background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), color-stop(@colorStop, @midColor), to(@endColor));
sankage's avatar
sankage committed
396
    background-image: -webkit-linear-gradient(@startColor, @midColor @colorStop, @endColor);
397
    background-image: -moz-linear-gradient(top, @startColor, @midColor @colorStop, @endColor);
sankage's avatar
sankage committed
398
399
    background-image: -o-linear-gradient(@startColor, @midColor @colorStop, @endColor);
    background-image: linear-gradient(@startColor, @midColor @colorStop, @endColor);
400
    background-repeat: no-repeat;
401
    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
402
  }
403
  .radial(@innerColor: #555, @outerColor: #333) {
404
405
406
407
    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);
408
    background-image: -o-radial-gradient(circle, @innerColor, @outerColor);
409
410
    background-repeat: no-repeat;
  }
411
  .striped(@color: #555, @angle: 45deg) {
Piotrek Okoński's avatar
Piotrek Okoński committed
412
    background-color: @color;
413
414
415
416
417
    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
418
  }
419
}
420
421
// Reset filters for IE
.reset-filter() {
422
  filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)"));
423
}
424

425

426
427
428
429

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

430
// Horizontal dividers
431
432
// -------------------------
// Dividers (basically an hr) within dropdowns and nav lists
433
.nav-divider(@top: #e5e5e5, @bottom: @white) {
Jacob Thornton's avatar
Jacob Thornton committed
434
435
436
  height: 1px;
  margin: ((@baseLineHeight / 2) - 1) 1px; // 8px 1px
  overflow: hidden;
437
438
  background-color: @top;
  border-bottom: 1px solid @bottom;
439
440
}

441
// Button backgrounds
442
// ------------------
443
.buttonBackground(@startColor, @endColor, @textColor: #fff, @textShadow: 0 -1px 0 rgba(0,0,0,.25)) {
Mark Otto's avatar
Mark Otto committed
444
  // gradientBar will set the background to a pleasing blend of these, to support IE<=*9
445
  .gradientBar(@startColor, @endColor, @textColor, @textShadow);
Jacob Thornton's avatar
Jacob Thornton committed
446
  .reset-filter();
447
448

  // in these cases the gradient won't cover the background, so we override
449
  &:hover, &:active, &.active, &.disabled, &[disabled] {
450
    color: @textColor;
451
    background-color: @endColor;
452
    *background-color: darken(@endColor, 5%);
453
454
  }

Mark Otto's avatar
Mark Otto committed
455
  // IE8 can't handle box-shadow to show active, so we darken a bit ourselves
456
457
458
459
460
461
  &:active,
  &.active {
    background-color: darken(@endColor, 10%) e("\9");
  }
}

462
463
464
465
466
467
468
469
// 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.
.navbarVerticalAlign(@elementHeight) {
  margin-top: (@navbarHeight - @elementHeight) / 2;
}

470

471
472
473
474

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

475
// Centered container element
476
477
.container-fixed() {
  margin-right: auto;
Jacob Thornton's avatar
Jacob Thornton committed
478
  margin-left: auto;
479
480
481
  .clearfix();
}

482
// Table columns
483
484
485
486
487
488
.tableColumns(@columnSpan: 1) {
  float: none; // undo default grid column styles
  width: ((@gridColumnWidth) * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1)) - 16; // 16 is total padding on left and right of table cells
  margin-left: 0; // undo default grid column styles
}

489
490
491
492
493
494
// Make a Grid
// Use .makeRow and .makeColumn to assign semantic layouts grid system behavior
.makeRow() {
  margin-left: @gridGutterWidth * -1;
  .clearfix();
}
495
.makeColumn(@columns: 1, @offset: 0) {
496
  float: left;
497
  margin-left: (@gridColumnWidth * @offset) + (@gridGutterWidth * (@offset - 1)) + (@gridGutterWidth * 2);
498
499
500
501
  width: (@gridColumnWidth * @columns) + (@gridGutterWidth * (@columns - 1));
}

// The Grid
502
503
#grid {

Mark Otto's avatar
Mark Otto committed
504
  .core(@gridColumnWidth, @gridGutterWidth, @gridRowWidth) {
505

Mark Otto's avatar
Mark Otto committed
506
    .spanX(@index) when (@index > 0) {
507
508
509
      (~".span@{index}") { .span(@index); }
      .spanX(@index - 1);
    }
Mark Otto's avatar
Mark Otto committed
510
    .spanX(0) {}
511

Mark Otto's avatar
Mark Otto committed
512
    .offsetX(@index) when (@index > 0) {
513
514
      (~".offset@{index}") { .offset(@index); }
      .offsetX(@index - 1);
515
    }
Mark Otto's avatar
Mark Otto committed
516
    .offsetX(0) {}
517

Mark Otto's avatar
Mark Otto committed
518
519
520

    // Base styles
    .offset(@columns) {
521
      margin-left: percentage(@columns / @gridColumns);
522
    }
Mark Otto's avatar
Mark Otto committed
523
    .span(@columns) {
524
      width: percentage(@columns / @gridColumns);
525
526
    }

527
    .row {
Mark Otto's avatar
Mark Otto committed
528
      // Negative indent the columns so text lines up
529
530
      margin-left: @gridGutterWidth / -2;
      margin-right: @gridGutterWidth / -2;
Mark Otto's avatar
Mark Otto committed
531
      // Clear the floated columns
532
533
534
535
      .clearfix();
    }

    [class*="span"] {
Mark Otto's avatar
Mark Otto committed
536
537
      float: left; // Collapse whitespace
      min-height: 1px; // Prevent empty columns from collapsing
538
539
      padding-left: @gridGutterWidth / 2;
      padding-right: @gridGutterWidth / 2;
Mark Otto's avatar
Mark Otto committed
540
      // Proper box-model (padding doesnt' add to width)
541
542
543
      -webkit-box-sizing: border-box;
         -moz-box-sizing: border-box;
              box-sizing: border-box;
544
545
    }

Mark Otto's avatar
Mark Otto committed
546
547
548
    // Generate .spanX and .offsetX
    .spanX(@gridColumns);
    .offsetX(@gridColumns);
549
550
551

  }

552
553
554

  .input(@gridColumnWidth, @gridGutterWidth, @gridRowWidth) {

Mark Otto's avatar
Mark Otto committed
555
556
    .spanX(@index) when (@index > 0) {
      (~"input.span@{index}, textarea.span@{index}, select.span@{index}, .uneditable-input.span@{index}") { .span(@index); }
557
558
      .spanX(@index - 1);
    }
Mark Otto's avatar
Mark Otto committed
559
    .spanX(0) {}
Mark Otto's avatar
Mark Otto committed
560

Mark Otto's avatar
Mark Otto committed
561
562
563
564
565
    .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
566

Mark Otto's avatar
Mark Otto committed
567
568
569
570
    .span(@columns) {
      // 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.
      width: percentage(@columns / @gridColumns) - percentage(@gridGutterWidth / @gridRowWidth);
      // Part 2: That subtracted width then gets split in half and added to the left and right margins.
571
572
573
574
      margin-left: percentage((@gridGutterWidth / 2) / @gridRowWidth);
      margin-right: percentage((@gridGutterWidth / 2) / @gridRowWidth);
    }

Mark Otto's avatar
Mark Otto committed
575
576
577
    .offset(@columns) {
      // Take the normal offset margin and add an extra gutter's worth.
      margin-left: percentage(@columns / @gridColumns) + percentage((@gridGutterWidth / 2) / @gridRowWidth);
578
579
    }

Mark Otto's avatar
Mark Otto committed
580
581
582
    // Generate .spanX and .offsetX
    .spanX(@gridColumns);
    .offsetX(@gridColumns);
583
584
585
586

  }


587
}