Bootstrap - How to align a Card horizontally inside a foreach?

0
      <article>

            <div class="container">

                <div class="row">

                    <div class="col-12 col-md-6 col-lg-4 mb-3 mb-md-0">

                    <?php foreach ($publicacao as $pl): ?>

                      <div class="card">

                        <div class="img-container">

                          <a href="index.php?post=<?php echo $pl['title']?>"><img src="<?php echo $pl['capa']?>" alt="<?php echo $pl['alt']?>" class="card-img-top"></a>

                        </div>

                        <div class="card-body">

                          <a href="index.php?post=<?php echo $pl['title']?>" class="card-title cardTitleLink"><h2 class="cardTitle"><?php echo $pl['title']?></h2></a>

                          <p class="card-text text-muted"><?php echo $pl['text']?></p>

                          <a href="index.php?post=<?php echo $pl['title']?>" class="btn btn-outline-danger btn-sm">Continue Lendo</a>

                        </div>

                      </div>

                    <?php endforeach; ?>

                    </div>

                </div>

            </div>

        </article>

I have this script, which returns the data from my Database. I have 10 records in the DB, only the cards are in a vertical line, one on top of the other. The right thing would be for the cards to be horizontally aligned, how do I do this?

    
asked by anonymous 08.09.2018 / 19:43

1 answer

0

I was able to solve it, I just put the foreach loop below the <div class"row" .

    
08.09.2018 / 22:25