Php 在html中重新排列div
我的php页面中有一个div,如下所示Php 在html中重新排列div,php,html,css,twitter-bootstrap,Php,Html,Css,Twitter Bootstrap,我的php页面中有一个div,如下所示 <div class="col-md-16" id=""> <div class="textwidget"> <?php while ($row = mysqli_fetch_array($queryResult)) { ?> <div style="margin-bottom: -15px; margin-right: 20px; background-color: #00
<div class="col-md-16" id="">
<div class="textwidget">
<?php while ($row = mysqli_fetch_array($queryResult)) { ?>
<div style="margin-bottom: -15px; margin-right: 20px; background-color: #008086;">
<img class="alignnone wp-image-401" src="uploads/2016/12/homa-1-300x199.png" alt="" width="56" height="37" style="margin-bottom: -19px;" />
<span class="About-us-Description" style="color: #ffffff;"><?php echo $row['Name'] ?></span><hr>
</div>
<div class="textwidget">
<?php
$query1 = "Select * from rituals where ritualtypeid=".$row['ritualtypeid'];
$queryResult1 = mysqli_query($dbcon, $query1);
?>
<?php while ($row1 = mysqli_fetch_array($queryResult1)) { ?>
<div class="Homas">
<a style="color: #000000;" href="">
<i class="fa fa-angle-right"></i> <span class="what-we-offer" style="color: #000000;">
<?php echo $row1['Name'] ?>
</span>
</a><br />
</div><?php } ?>
</div><?php } ?>
</div>
</div>
但实际上我想展示的是
**Heading1** **Heading2** **Heading3**
Content1 Content3 Content5
Content2 Content4 Content6
---------------------------------------------------
**Heading4**
Content7
Content8 so on
3个div之后,我需要换行,下一个div应该出现在下一行。怎么做。感谢您的帮助。您的代码实际上并没有解释您的输出,但无论如何,如果您使用的是twitter引导,那么您需要为所有元素提供一个
col-md-4
类,并将它们包装在行fuild
div中。类似这样的内容:
<div class="row-fluid">
<div class="col-md-4" id="" >
<div class="textwidget"><?php while ($row = mysqli_fetch_array($queryResult)) { ?>
<div style="margin-bottom: -15px; margin-right: 20px; background-color: #008086;">
<img class="alignnone wp-image-401" src="uploads/2016/12/homa-1-300x199.png" alt="" width="56" height="37" style="margin-bottom: -19px;" />
<span class="About-us-Description" style="color: #ffffff;"><?php echo $row['Name'] ?></span><hr></div>
<div class="textwidget">
<?php
$query1 = "Select * from rituals where ritualtypeid=".$row['ritualtypeid'];
$queryResult1 = mysqli_query($dbcon, $query1);
?>
<?php while ($row1 = mysqli_fetch_array($queryResult1)) { ?>
<div class="Homas"><a style="color: #000000;" href="">
<i class="fa fa-angle-right"></i> <span class="what-we-offer" style="color: #000000;">
<?php echo $row1['Name'] ?> </span></a><br />
</div><?php } ?>
</div><?php } ?>
</div>
</div>
</div>
您使用的是class=“col-md-16”
我认为这个类在引导中不可用,因为引导有12个网格系统。请尝试以下代码,这正是您要查找的内容:
引导示例
**标题1**
内容1
内容2
**标题2**
内容3
内容4
**标题3**
内容5
内容6
**标题4**
内容7
内容8
**标题5**
内容9
内容10
**标题6**
内容11
内容12
所以。。。推特引导,12宽。。一行3列,数字为4。。并为下一行定义一个新的div?是否使用引导?“col-md-16”那个类存在吗?@AngryCoder当然不存在。
<div class="row-fluid">
<div class="col-md-4" id="" >
<div class="textwidget"><?php while ($row = mysqli_fetch_array($queryResult)) { ?>
<div style="margin-bottom: -15px; margin-right: 20px; background-color: #008086;">
<img class="alignnone wp-image-401" src="uploads/2016/12/homa-1-300x199.png" alt="" width="56" height="37" style="margin-bottom: -19px;" />
<span class="About-us-Description" style="color: #ffffff;"><?php echo $row['Name'] ?></span><hr></div>
<div class="textwidget">
<?php
$query1 = "Select * from rituals where ritualtypeid=".$row['ritualtypeid'];
$queryResult1 = mysqli_query($dbcon, $query1);
?>
<?php while ($row1 = mysqli_fetch_array($queryResult1)) { ?>
<div class="Homas"><a style="color: #000000;" href="">
<i class="fa fa-angle-right"></i> <span class="what-we-offer" style="color: #000000;">
<?php echo $row1['Name'] ?> </span></a><br />
</div><?php } ?>
</div><?php } ?>
</div>
</div>
</div>