Bring back .col base class to simplify gutter control
I couldn't find any discussion about removing/using a .col base class.
Related to this commit from 2 months ago: Grid updates by @mdo.
I understand removing it to keep the HTML cleaner, I really do, but the css actually got a lot more complex.
Now you need to override 36 col classes to have a custom gutter in addition to the default. Are custom gutters so uncommon that it's not worth using another class?
I personally use them, and a .row-reponsive with a variable gutter depending on the viewport width, so you can imagine the work it is to accomplish that today.
Mixins could make this easier, but the compiled CSS would still be unnecessarily big.
.some-custom-gutter > .col-1,
.some-custom-gutter > .col-sm-1,
.some-custom-gutter > .col-lg-1,
.some-custom-gutter > .col-2,
.some-custom-gutter > .col-sm-2,
.some-custom-gutter > .col-lg-2,
... {
padding-right: 5px;
padding-left: 5px;
}
Using .col:
.some-custom-gutter > .col {
padding-right: 5px;
padding-left: 5px;
}
Negatory, we won't be doing that. We'll be improving the grid mixins shortly though, so if you need custom grid styles, I'd suggest moving towards that when it's done. (And yes we'll probably add a var in those for gutter width.)
Have to comment here - I may be entirely wrong in my assumptions, but a custom less grid:
// Narrow grid style
[class^="col-"].ng {
padding-left: (@grid-gutter-width / 4);
padding-right: (@grid-gutter-width / 4);
&.fc {
padding-left: (@grid-gutter-width / 2);
}
&.lc {
padding-right: (@grid-gutter-width / 2);
}
}
Has the benefit of fitting with the current default via two classes, fc (first col) and lc (last col) - compiles to:
[class^="col-"].ng {
padding-left: 7.5px;
padding-right: 7.5px;
}
[class^="col-"].ng.fc {
padding-left: 15px;
}
[class^="col-"].ng.lc {
padding-right: 15px;
}
am I missing something here?
@mattpi Bootstrap stopped using this kind of selectors for being too heavy on the browser to process. I wouldn't add it to my code. So you'd still have to write all classes.
I was going with a modifier class on .row, you're going with a modifier class on .col. I'm not sure which is best, on both you have to override 36 col classes. Modifying .row seems cleaner specially if you're doing things programatically, you have to change the class in only one element.
@mdo I understand your decision. The mixin is elegant (will be even better with gutter control) and it's semantic.
My problem is probably an edge case. I need a the whole 12 col grid flexibility and power with a custom gutter that will be used in many areas, not just defining a couple of specific columns like on the mixin example. That is a lot of things to override but I can live with that.
I use the compiled CSS (with Sass). I know how easy it is to depend on mixins and have the compiled CSS lose it's simplicity.