Limit images per line using Flexbox

Asked

Viewed 190 times

5

I’m using flexbox to show images, but it lists all in one row, I wish I could display 3 images per line.

HTML structure:

<section class="content">
    <?php
    $i=0;
    $sql = mysql_query("SELECT * FROM slideshows");
    while($result = mysql_fetch_array($sql)){
        $imagem = $result['imagem'];
        $titulo = $result['titulo'];?>
        <div class="item"><img src="<?php echo $imagem; ?>"></div>
    <?php }?>
</section>

CSS:

.content{
width: 100%;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: space-around;
}

.item{
width:303px; height: 242px;
display: block;
}

I’m using a pagination style to display the images, it’s all right, however, it’s showing everything in the same line, I’d like you to show 3 by lines...

http://planow.com.br/jrgrill/dicas.php

php to display with paging:

$outputList = '';

while($Row = mysql_fetch_array($sql2)){

$id = $row["id"];
$imagem = $row["imagem"];
$nome = $row["nome"];
$nome = utf8_encode($nome);

$outputList .= '<section class="content"><div class="item"><img src="admin/images/' . $imagem . '"></div><div class="caixa-texto">' . $nome . ' </div></section>';

} // close while loop ?>

                <div class="imagens-dicas-churrasco">
                <?php print "$outputList"; ?>
            </div>
            <div style="padding:6px;float:right;"><?php echo $paginationDisplay; ?></div>

1 answer

2

  • ptz...vlw @bfavareto.... mto good....

  • I used a pagination in my image view, however, it is listing everything in the same line, already put flex-wrap:wrap; but still continues.... http://planow.com.br/jrgrill/dicas.php

  • I changed my question, I’m not able to see 3 items per line, can help me?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.