[英]fixing position of cells in table (bootstrap)
我嘗試使用上方(主行)單元格修復引導程序中單元格的位置,但我不能
這是我的代碼
<body> <div class="container"> <table class="table table-striped table-bordered text-center" dir="rtl"> <tr> <td >ردیف</td> <td >عنوان</td> <td >ویرایش</td> <td >حذف</td> </tr> </table> </div> <?php connect(); $news=mysql_query("select * from news"); while($row=mysql_fetch_array($news)){ $i++; if($i %2 == 0) $bg='#9999FF'; else $bg='#fff'; echo '<div class="container">'; echo '<table class=" table table-striped table-responsive table-bordered text-center table-hover" dir="rtl">'; echo '<tr >'; echo '<td>'. $i.'</td>'; echo '<td>'. $row['title'].'</td>'; echo '<td ><a href="?link=nedit&ncod='.$row['ncod'].'"><i class="fa fa-edit fa-3x " ></i></a></td>'; echo '<td ><a href="?link=ndel&ncod='.$row['ncod'].'&npic='.$row['npic'].'"><i class="fa fa-trash fa-3x "style="color:red" ></i> </a> </td>'; echo '</tr> '; echo '</table>'; echo '</div>'; } ?> </body>
與上面的單元格相比,我需要修復下面的單元格
謝謝
你在每一行打開和關閉一個table
和一個div
,這就是為什么;
在標題之前打開table
一次,而不是在循環之后關閉一次。
<body>
<div class="container">
<table class="table table-striped table-bordered text-center" dir="rtl">
<tr>
<td >ردیف</td>
<td >عنوان</td>
<td >ویرایش</td>
<td >حذف</td>
</tr>
<?php
connect();
$news=mysql_query("select * from news");
while($row=mysql_fetch_array($news)){
$i++;
if($i %2 == 0)
$bg='#9999FF';
else
$bg='#fff';
echo '<tr >';
echo '<td>'. $i.'</td>';
echo '<td>'. $row['title'].'</td>';
echo '<td ><a href="?link=nedit&ncod='.$row['ncod'].'"><i class="fa fa-edit fa-3x " ></i></a></td>';
echo '<td ><a href="?link=ndel&ncod='.$row['ncod'].'&npic='.$row['npic'].'"><i class="fa fa-trash fa-3x "style="color:red" ></i> </a> </td>';
echo '</tr> ';
}?>
</table>
</div>
</body>
我自己修復這里是我的最終代碼
<body> <?php connect(); $news=mysql_query("select * from news"); echo '<div class="container">'; echo '<table class=" table table-striped table-responsive table-bordered text-center table-hover" style="white-space:nowrap; white-space-collapse:discard" dir="rtl">'; echo '<tr>'; echo '<th>ردیف </th> '; echo '<th>عنوان</th> '; echo '<th>ویرایش </th> '; echo '<th>حذف</th> '; echo '</tr>'; while($row=mysql_fetch_array($news)){ $i++; if($i %2 == 0) $bg='#9999FF'; else $bg='#fff'; echo '<tr >'; echo '<td>'. $i.'</td>'; echo '<td>'. $row['title'].'</td>'; echo '<td ><a href="?link=nedit&ncod='.$row['id'].'"><i class="fa fa-edit fa-3x " ></i></a></td>'; echo '<td ><a href="?link=ndel&ncod='.$row['ncod'].'&npic='.$row['npic'].'"><i class="fa fa-trash fa-3x "style="color:red" ></i> </a> </td>'; echo '</tr> '; } ?> </table> </div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.