-2

I would like to put 5 columns next to each other in a .row div. If i delete the col-sm-6 col-md-3 classes from the divs, and just give a simple .col class, nothing happens also.

I show you a photo of my source code. If i put a .clearfix div after every 5. col div, why doesnt it works?

Photo of console

    echo '<div class="row">';
$otodik = "";
                 include_once("files/show_products.php");
                 echo '</div>';

In a while loop:

    <?php while($item = mysqli_fetch_assoc($get_items)){ if($otodik%5 == 0) { echo '<div class="clearfix"></div>'; } ?>
<div class="col-sm-6 col-md-3 text-center mb-5">
    <a href="<?php echo $host; ?>/webshop/<?php echo $seolink_kat ."/". html($item['termek_seo']); ?>" class="" title="<?php echo html($item['termek_nev']); ?>">
        <img data-src="https://gras.hu/images/item/<?php echo html($item['termek_thumb']).t2(); ?>" alt="<?php echo html($item['termek_nev']); ?>" class="img-fluid main_product_thumb lazyload">
    </a>
    <h2 class="main_item_title">
        <a href="<?php echo $host; ?>/webshop/<?php echo $seolink_kat ."/". html($item['termek_seo']); ?>" class="" title="<?php echo html($item['termek_nev']); ?>"><?php echo html($item['termek_nev']); ?></a>
    </h2>
    
    
</div>
<?php $otodik++; } ?>
<div class="clearfix"></div>
greg777x
  • 11
  • 6

1 Answers1

1

Its much simpler with bootstrap 4 as grid system now supports flexbox. You just need to add class col to every column in a row.

<div class="container">
    <div class="row">
        <div class="col mx-1">1</div>
        <div class="col mx-1">2</div>
        <div class="col mx-1">3</div>
        <div class="col mx-1">4</div>
        <div class="col mx-1">5</div>
   </div>
</div>
brooksrelyt
  • 3,925
  • 5
  • 31
  • 54
Harkirat singh
  • 599
  • 6
  • 19