[英]I want to put panels side by side with bootstrap
I fetch some info from the database with a while loop to output panels side by side with boostrap. 我通过while循环从数据库中获取一些信息,以与boostrap并排输出面板。
This is the code: 这是代码:
<?php
$sql = "SELECT * FROM items ORDER BY `id`";
$res = mysqli_query($conn,$sql);
$x = 4;
while($page = mysqli_fetch_assoc($res)){
echo "<div class='col-lg-$x col-md-5'>
<div id='posts' class='transitions-enabled masonry'>".
"<div class='box panel panel-default masonry-brick' style='position: absolute; top: 0px; left: 0px;'' target='_blank>".
"<a href=''><img src=''></a>".
"<h2 class='box_text_hover'>". $page["name"]"."</h2>".(float)$page["price"]." ".
"<a href='item.php?id=".$page["id"]."'>See more!</a>".
"</div></div>".
"</div>";
$x+=2;
}
mysqli_close($conn);
?>
But the output is always looks like this: 但是输出总是看起来像这样:
Please add the full code of your php. 请添加您的php的完整代码。 It seems like you are not assigning a "col-sm-4" class to your div class="panel panel-default". 似乎您没有为div class =“ panel panel-default”分配“ col-sm-4”类。 The number 4 is the width of your panel. 数字4是面板的宽度。 The sum of these numbers echoed with your while loop can't be higher than 12. while循环回显的这些数字的总和不能大于12。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.