我有一个放置特定行的数据库。我的代码可以做到这一点,但我希望我的桌子周围有一个虚线边框。下面的代码应该围绕这一行做一个虚线,但我不知道为什么它不起作用。有人可以帮忙吗?
$count = 1
echo "<table>";
echo "<tr> <th>Pos</th> <th>Team</th> <th>PLD</th> <th>W</th> <th>D</th>
<th>L</th> <th>F</th> <th>A</th> <th>GD</th> <th>PTS</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
if($count == 5) {
echo "<tr style='border-style:dashed'><td>";
echo $row['Pos'];
echo "</td><td>";
echo $row['Team'];
echo "</td><td>";
echo $row['PLD'];
echo "</td><td>";
echo $row['W'];
echo "</td><td>";
echo $row['D'];
echo "</td><td>";
echo $row['L'];
echo "</td><td>";
echo $row['F'];
echo "</td><td>";
echo $row['A'];
echo "</td><td>";
echo $row['GD'];
echo "</td><td>";
echo $row['PTS'];
echo "</td></tr>";
}
else {
echo "<tr><td>";
}
答案 0 :(得分:2)
不允许直接造型。 您应该将边框放在元素上,并使用border-right和border-left来删除列之间的边框。
<tr>
<td style="border: 1px dashed black; border-right: none">Left</td>
<td style="border: 1px dashed black; border-left: none; border-right: none">Middle</td>
<td style="border: 1px dashed black; border-left: none; border-right: none">Middle</td>
<td style="border: 1px dashed black; border-left: none">Right</td>
</tr>
你真的应该使用html类和CSS文件。