The Bootstrap docs over at W3 Schools (which are otherwise flawless and amazing!) don't do a great job of explaining when to use the various column classes. They just describe these classes with:
xs
(for phones - screens less than 768px wide)sm
(for tablets - screens equal to or greater than 768px wide)md
(for small laptops - screens equal to or greater than 992px wide)lg
(for laptops and desktops - screens equal to or greater than 1200px wide)
But then they never make it clear (at least to me) as to when I should be using sm
vs xs
, etc. To me its strange that Bootstrap even offers these classes since I thought the whole point was for Bootstrap to look uniform and consistent and then just automatically respond when the screen size changes...so making behavior flexible based on the user's device is not something I think a CSS framework would be exposing to the API developer...
Either way, what's the difference between this:
<div class="row">
<div class="col-sm-4">.col-sm-4</div>
<div class="col-sm-4">.col-sm-4</div>
<div class="col-sm-4">.col-sm-4</div>
</div>
and this:
<div class="row">
<div class="col-xs-4">.col-xs-4</div>
<div class="col-md-4">.col-md-4</div>
<div class="col-lg-4">.col-lg-4</div>
</div>
and this:
<div class="row">
<div class="col-sm-4">.col-sm-4</div>
<div class="col-lg-8">.col-lg-8</div>
</div>
? In other words, if all the column widths have to add up to 12 anyway, what's the difference between declaring them as xs
vs sm
vs md
vs lg
?