Selsku Selsku - 1 month ago 9
CSS Question

Why do you put bootstrap classes into a div?

Image

Why can't I put the class="col-xs-4" to the button's class?
It's stupid to not do that and will require extra typing for single elements.

Answer

The reason Bootstrap and most other frameworks like it use divs as their styling wrappers is because they're non-semantic, purely presentational elements. They're purely containers - whereas something like a button is actual page content. The mindset goes: leave the grid-sizing and layout to the containers, and then just let your actual content fill those containers. Think of them as different layers of concern - col-xs-4 is just a box to put something in.

Comments