I've read about the grid system here: http://getbootstrap.com/css/#grid. While the documentation doesn't directly address a scenario in which there's one column within a row, I do see one example of this here: http://getbootstrap.com/css/#grid-offsetting > third row of the example code.
Currently, I'm applying the class .col-xs-12 to the one column within the containing tags and it is working well across all viewport dimensions. However, I want to ensure there isn't a better way to do this.
Thanks!
The Bootstrap grid has only 12 columns, so you should never have more than 12 columns in a row. You should have only 3 col-md-4 in each .
You can nest columns once you have a container, row, and column set up. To do this, add a new row <div> within the parent column's code, then add your nested columns. It will function as if the area inside the new row is its own grid system.
There are 12 template columns available per row, allowing you to create different combinations of elements that span any number of columns. Column classes indicate the number of template columns to span (e.g., col-4 spans four).
Bootstrap's grid system allows up to 12 columns across the page.
I think adding a col*-12 will be the best practice. It will make all rows in your grid act the same.
Example:
html
<div class="container"> <div class="row" style="background-color:yellow;"> <div class="col-xs-12" style="background-color:aqua;">col-xs-12 inside a row</div> </div> </div> <div class="container"> <div class="row" style="background-color:yellow;"> direct inside a row </div> </div> <div class="container"> <div class="row" style="background-color:yellow;"> <div class="col-xs-6" style="background-color:red;">col-xs-6 inside a row</div> <div class="col-xs-6" style="background-color:orange;">col-xs-6 inside a row</div> </div> </div>
As you see the content is NOT in line with the other rows when you don't add a col-*-12 (due to the missing padding). All the rows the same will make future changes easier.
You will have to notice the col*-12 columns differs from the other col-- cause the don't have a float left, see: https://github.com/twbs/bootstrap/issues/10152
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