1

I have simple layout in HTML using Bootstrap like so

<div class='row'>
    <div class="col-6">
     <div class="col-2">
       FOO
     </div>
     <div class="col-4">
       BAR
     </div>
    </div>
</div>

I expected it be FOO and BAR next to each other, but it is not so? Why? Can someone help me with this?

Here is a Demo

Rehan
  • 3,813
  • 7
  • 37
  • 58
  • 1
    read the doc to understand how to correctly nest column : https://getbootstrap.com/docs/4.1/layout/grid/#nesting .. you need row and you also need container as a main wrapper – Temani Afif Oct 28 '18 at 11:49

2 Answers2

0

You have nested the columns, please read the docs about bootstrap. To achieve your scope try this code:

<div class='row'>
  <div class="col-6">
  </div>
  <div class="col-2">
    FOO
  </div>
  <div class="col-4">
    BAR
  </div>
</div>
0

The grid system has a full size of 12. Hence the columns could have combination of any one of below:

Grid system

Vishnudev Krishnadas
  • 10,679
  • 2
  • 23
  • 55