宽度table 列bootstrap 3.3 带按钮
Width table column bootstrap 3.3 with button
我在 template.php 中使用 "view" 按钮得到了以下 table。我正在使用 bootstrap 3.3.7
<?php
if($num>0){
echo "<table class='table table-responsive table-sm table-hover table-bordered'>";
echo "<thead>";
echo "<tr>";
echo "<th>Name</th>";
echo "<th>Description</th>";
echo "<th></th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
extract($row);
echo "<tr>";
echo "<td>{$name}</td>";
echo "<td>{$description}</td>";
echo "<td>";
echo "<a href='view_thing.php?id={$id}' class='btn-info btn-sm'>";
echo "<span class='glyphicon glyphicon-eye-open'></span> View";
echo "</a>";
echo "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
?>
看起来像:
table test 1
我尝试了什么:
<th class="col-md-1"></th>
<th style="width: 10%"></th>
应该做什么:
最后一列应适合按钮大小。
解决方案:
echo <th style=width: '10%'></th>
我在 template.php 中使用 "view" 按钮得到了以下 table。我正在使用 bootstrap 3.3.7
<?php
if($num>0){
echo "<table class='table table-responsive table-sm table-hover table-bordered'>";
echo "<thead>";
echo "<tr>";
echo "<th>Name</th>";
echo "<th>Description</th>";
echo "<th></th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
extract($row);
echo "<tr>";
echo "<td>{$name}</td>";
echo "<td>{$description}</td>";
echo "<td>";
echo "<a href='view_thing.php?id={$id}' class='btn-info btn-sm'>";
echo "<span class='glyphicon glyphicon-eye-open'></span> View";
echo "</a>";
echo "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
?>
看起来像: table test 1
我尝试了什么:
<th class="col-md-1"></th>
<th style="width: 10%"></th>
应该做什么:
最后一列应适合按钮大小。
解决方案:
echo <th style=width: '10%'></th>