3 ms·
I have to disagree with you here. The 'row' and 'span' pieces are a small part of the overall bootstrap package. If we leave them aside for a moment (and come b
by scopestar 15y ago
I have to disagree with you here. The 'row' and 'span' pieces are a small part of the overall bootstrap package. If we leave them aside for a moment (and come back to them later), I think most of the Bootstrap class names are well thought out and even "semantically" meaningful. If I'm going to show a button and its the primary button, I could to much worse then a class named btn-primary. Same goes for alert-warning, progress-info, page-header, etc.
The purpose of the library is bootstrap. I've seen much worse choices made by web sites that don't employ consistent approaches towards semantically meaningful class names then bootstrap is using. If down the road, after my "bootstrapping" days are done I want to overhaul my css, I can redefine, extend or whatever I want with a class named 'alert-info'. But chances are pretty good that whatever I want this alert box to look like, it is still going to be an info alert box from a semantic standpoint. I'm not really "hardcoding" anything. I'm using a consistent naming convention for my semantically described elements/components. Have I really accomplished anything better by giving my alert-info box a custom name of my-alert-info-box?. I argue no. If the class name was 'bootstrap-red-square-box' that would be a different story.
As far as row and span thing goes, you have to pick your poisons. A lot of people use grid layout systems (blueprint, 960, etc.) and most of these require some row, span, column, gutter class markup. I think people have pragmatically learned over the years that while we don't want to force layout into tables (because they have a different semantic purpose), the holy grail of 100% layout free css class names my not be worth the cost. Generally a layout change requires some markup change no matter how pure your naming is.
I wouldn't throw the whole Bootstrap class naming convention overboard just because of the row and span thing.
- compay 15y agoI agree many of the class names are well-chosen. But maybe they're not fine for every application. And Twitter may change them between versions (as they already have). The point is not to completely avoid using their naming scheme - the point is to avoid unnecessarily depending on it throughout all your HTML files, when you can easily isolate the dependency to a single Less file. If you're using something like Less or SCSS, there is almost no need at all to depend on the class names, you can use them or not use them as you see fit. We wrote the article because a lot of people are not aware they have a choice.