in bootstrap-responsive.css
.row-fluid .span10{
width: 91.45299145299145%;
*width: 91.39979996362975%;
}
I was configuring the sizing, but am curious as to how they derived these numbers, and why are they accurate to 14 decimal places?
They start with three values, which can be user-defined:
@gridColumns: 12;
@gridColumnWidth: 60px;
@gridGutterWidth: 20px;
Edit: on Bootstrap 3.0+, the variables are now:
@grid-columns
@grid-gutter-width
@grid-float-breakpoint // the point at which the navbar stops collapsing
And calculate fixed row width:
@gridRowWidth: (@gridColumns * @gridColumnWidth) + (@gridGutterWidth * (@gridColumns - 1));
Then they go fluid:
@fluidGridColumnWidth: percentage(@gridColumnWidth/@gridRowWidth);
@fluidGridGutterWidth: percentage(@gridGutterWidth/@gridRowWidth);
And finaly, generate all the spans (that is a bit confusing):
.spanX (@index) when (@index > 0) {
(~".span@{index}") { .span(@index); }
.spanX(@index - 1);
}
.span (@columns) {
width: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1));
*width: (@fluidGridColumnWidth * @columns) + (@fluidGridGutterWidth * (@columns - 1)) - (.5 / @gridRowWidth * 100 * 1%);
}
.row-fluid {
// generate .spanX and .offsetX
.spanX (@gridColumns);
.offsetX (@gridColumns);
}
As you see, LESS does the divisions and multiplications.
See it yourself:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With