3 ms·
My concern with both of these is that I'm slapping classes on all of my UI everywhere. Why can't a button just get all of the bootstrap btn styles automatically
by Sir_Cmpwn 11y ago
My concern with both of these is that I'm slapping classes on all of my UI everywhere. Why can't a button just get all of the bootstrap btn styles automatically? Why not have forms look right just by selecting the elements that make them up? This is a problem for Foundation too. Does anyone know why they have chosen to do this?
- DougWebb 11y agoIt's a choice between opt-in and opt-out; sometimes you don't want the framework styles applied and you need a way to control that. The drawback to opt-out is that you may not control the markup where the styles shouldn't apply.
- ianleeclark 11y agoIt seems fairly over-opinionated for the framework to declare every button as exactly the same. What if a developer needs one orange square button and one normal, greyish-silver boostrap button. If every class is automatically applied to each button, you're going to need to override the styling for that specific orange, square button.
- lmm 11y agoWell yeah. The defaults should be defaults, and if you want to change them you override them. No?
- sbarre 11y agoAnd the defaults are provided by the browser, are they not?
- lmm 11y agoThe browsers have really dropped the ball though. Something like 80% of bootstrap should just be the default stylesheet in modern browsers, IMO.
- nilliams 11y agoThat's how e.g. Bootstrap 2 worked. It sucked. Bootstrap 3 moved to opt-in styles and it is way better. If you really want all buttons to be BS-like you simply write (in Less -- I cba to look up the Sass but it's similarly trivial): button { .btn; }
- fuzzywalrus 11y agoI quite frequently use Bootstrap but with almost all of it paired down to the absolute minimums. Bootstrap 3 (at least) was comprehensible and easy enough to whittle down by commenting out large swaths of UI. Usually, I simply use the Bootstrap grid since we have contracts who dance in and out of projects or new developers. Everyone can safely assume that they have "col-sm-" classes and know how they work. I usually mimic bootstrap classes too like btn even if I can't recall the last time in the last 3+ years I've left any of its buttons/forms etc in tact.
- superchink 11y agoBoth Bootstrap and Foundation support using their styles with SASS mixins, so you can create your own semantic classes, rather than slapping their classes on your markup. See an example here: http://v4-alpha.getbootstrap.com/layout/grid/#sass-mixins http://v4-alpha.getbootstrap.com/layout/grid/#sass-mixins