我有一个数据库,将放置特定的行。我的代码可以做到这一点,但是我想在表的周围使用虚线边框。下面的代码应该在该行周围用虚线表示,但是我不知道为什么它不起作用。有人可以帮忙吗?

$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>";
 }

最佳答案

不允许直接设置样式。
您应该在元素上放置边框,并使用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文件。

关于php - 虚线不显示HTML,PHP,MySql,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20424727/

10-14 17:50