Search code examples
htmlcssbootstrap-4frontendweb-frontend

How create a bootstrap grid with one column above and two below?


My ask is: how can I transform a bootstrap grid with three columns on desktop version, in one column above and two below on mobile version?

I already tried a lot of things without success...

enter image description here


Solution

  • Change in mobile screen col-6 last two div and first is col-12, col-xs-* have been dropped in Bootstrap 4 in favor of col-*

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
    
    <div class="container-fluid">
      <div class="row">
        <div class="col-12 col-sm-4 text-center">
          <p>1</p>
        </div>
        <div class="col-6 col-sm-4 text-center">
          <p>2</p>
        </div>
        <div class="col-6 col-sm-4 text-center">
          <p>3</p>
        </div>
      </div>
    </div>