1

Why can I use bootstrap col classes without the number of cols and how is this interpreted? E.g. in the snippet

<div class="row row-header">
  <div class="col-12 col-sm-8">
  </div>
  <div class="col col-sm align-self-center">
  </div>
</div>

the second inner div uses col classes that corresponding dimensionally to the col classes of the first inner div. What does it mean?

Oblomov
  • 8,953
  • 22
  • 60
  • 106

1 Answers1

0

To my knowledge col class has been introduced in Bootstrap 4. This class works because Bootstrap 4 uses display:flex to layout content rather than the classic float:left. With flexbox you don't have to explicitly define width for each column. If a .row contains two cols, the cols occupy 50% of the width of .row, if three cols then 33.3333% width and so on. Check out this excellent article on CSS Tricks to know about flexbox in detail.

Tejasvi Karne
  • 628
  • 4
  • 14