我在数据库中的表中创建了一个描述("specs")。然后放到我的PHP文件中
<h5><?php echo $row["specs"];?></h5>
如何对齐文本:
Bold: Details
Bold: Details
Bold: Details
Bold: Details
Bold: Details
可能html table元素最适合:
<table>
<?php foreach($rows as $row) { ?>
<tr>
<td><?php echo $row["the field in Bold"];?></td>
<td><?php echo $row["Details field"];?></td>
</tr>
<?php } ?>
</table>
CSS中:
table td:first-child{
font-weight: bold;
}
它是这样工作的。在你的问题中,元素是这样对齐的:
table td:first-child {
font-weight: bold;
}
<table>
<tr>
<td>bold:</td>
<td>description</td>
</tr>
<tr>
<td>bold:</td>
<td>description</td>
</tr>
<tr>
<td>bold:</td>
<td>description</td>
</tr>
<tr>
<td>bold:</td>
<td>description</td>
</tr>
</table>
试试下面的代码:
<?php
foreach($rows as $row) {
echo "'n<h5>" . $row["specs"] . "</h5>";
}
?>