上面是一张我希望完全放在白色区域内的桌子。所以我需要它转移到左侧。 这是表格:
<table class="inventory" style="float:left; position:relative;">
<tbody>
<tr>
<th>Name</th>
<th>Rate</th>
<th>OT</th>
<th>Leaves</th>
<th>Total</th>
</tr>
<?php
$sth = $conn->prepare('SELECT * FROM employee');
$sth->execute();
$data = $sth->fetchAll();
foreach ($data as $row ){
?>
<tr>
<td>
<input type="text" placeholder="Name" value="<?php echo $row['name']?>"/>
</td>
<td>
<input type="text" placeholder="Rate" value="<?php echo $row['rate']?>"/>
</td>
<td>
<input type="text" placeholder="OT" value="<?php echo $row['overtime_hrs']?>"/>
</td>
<td>
<input type="text" placeholder="Leaves" value="<?php echo $row['leaves_per_month']?>"/>
</td>
<td>
<input type="text" placeholder="Total" value="<?php echo $row['total']?>"/>
</td>
</tr>
<?php }?>
</tbody>
</table>
这里是CSS:
.table {
width: 20%;
border-collapse: collapse;
border-spacing: 0;
float:left;
}
我刚刚添加了float:left,但这也没有。