如何使用引导列在PHP中连续显示图像和文本?

想要在同一列中以5行显示图像和文本,但是在所显示的代码中,这并不能满足我的要求,因为当它们显示时,它们以行而不是列显示。多谢您的协助。


该图像显示了屏幕上当前显示的内容...


http://img1.mukewang.com/609cbd0c0001568d13710379.jpg

我想要的是...


http://img.mukewang.com/609cbd16000120c404340246.jpg

<?php

    $select_stmt=$db->prepare("SELECT * FROM galeria ORDER BY id DESC;" );  //sql select query

    $select_stmt->execute();

    while($row=$select_stmt->fetch(PDO::FETCH_ASSOC))

    {

?>


<div class="container">

    <div class="row">

        <div class="col-sm-12">

            <div class="col-sm-6"><img src="upload/<?php echo $row['image']; ?>" class="imagem" style="height: 100px; weight: 100px;"></div>

            <div class="col-sm-6"><a id=""><?php echo $row['texto'];?></a></div>

        </div>

    </div>

</div>


<?php

}

?>


慕桂英4014372
浏览 128回答 3
3回答

交互式爱情

现在正在工作。感谢大家的帮助。这是下面的代码。<div class="container"><div class="row"><?php&nbsp; &nbsp; $select_stmt=$db->prepare("SELECT * FROM galeria ORDER BY id DESC;" );&nbsp; //sql select query&nbsp; &nbsp; $select_stmt->execute();&nbsp; &nbsp; while($row=$select_stmt->fetch(PDO::FETCH_ASSOC))&nbsp; &nbsp; {?>&nbsp; &nbsp; &nbsp; &nbsp; <div class="col-sm-2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="col-sm-12"><img src="upload/<?php echo $row['image']; ?>" class="imagem" style="height: 100px; weight: 100px;"></div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="col-sm-12"><a id=""><?php echo $row['texto'];?></a></div>&nbsp; &nbsp; &nbsp; &nbsp; </div><?php}?></div></div>

汪汪一只猫

您不应该每行创建一个容器。只有一个包含所有行的容器将您的代码更改为此:<div class="container"><?php&nbsp; &nbsp; $select_stmt=$db->prepare("SELECT * FROM galeria ORDER BY id DESC;" );&nbsp; //sql select query&nbsp; &nbsp; $select_stmt->execute();&nbsp; &nbsp; while($row=$select_stmt->fetch(PDO::FETCH_ASSOC))&nbsp; &nbsp; {?>&nbsp; &nbsp; <div class="row">&nbsp; &nbsp; &nbsp; &nbsp; <div class="col-sm-12">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="col-sm-6"><img src="upload/<?php echo $row['image']; ?>" class="imagem" style="height: 100px; weight: 100px;"></div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="col-sm-6"><a id=""><?php echo $row['texto'];?></a></div>&nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; </div><?php}?></div>

饮歌长啸

我的方式&nbsp;<div class="col-md-3 col-sm-6 col-xs-12">&nbsp; &nbsp; <a href="/images/<?php echo...&nbsp;&nbsp; &nbsp; &nbsp; </div>或者<div style="float: left; margin-left: 20px; margin-top: 10px;">&nbsp; &nbsp; <a href="/images/<?php echo...&nbsp; &nbsp; &nbsp; &nbsp; </div>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript