Echo在其他行上运行良好但是当我尝试在此表中添加标签时,我看到标签已放置在标签之外。
<table>
<th style="cursor:pointer;border-radius:5px 0px 0px 0px;">Başlık</th>
<th style="cursor:pointer;">Başlatan</th>
<th style="cursor:pointer;border-radius:0px 5px 0px 0px;">Tarih</th>
$sonuc = mysql_query("select A.subject, A.poster_name, A.poster_time, A.id_msg, A.id_topic, B.id_first_msg, B.id_member_started from smf_messages A, smf_topics B WHERE A.id_msg = B.id_first_msg ORDER BY id_topic DESC LIMIT 10");
if(mysql_num_rows($sonuc)!=0)
{
while($oku = mysql_fetch_object($sonuc))
{
echo '<tr id="iceriktablo" style="cursor:pointer;margin-top:0;margin-bottom:0;">';
echo '<a href="forum/index.php?topic='. $oku->id_topic .'"><td style="font-size:13px;font-weight:bold;">';
echo $oku->subject;
echo '</td></a>';
echo '<a href="forum/index.php?topic='. $oku->id_topic .'"><td style="font-size:13px;font-weight:bold;"><center><b>';
echo $oku->poster_name;
echo '</b></center></td></a>';
echo '<td style="font-size:13px;font-weight:bold;"><center><b>';
$zaman = $oku->poster_time;
echo gmdate("d-m-Y\ H:i:s", $zaman);
echo '</b></center></td></tr></a>';
}
}else{
echo "Hiçbir kayıt bulunamadı!";
}
mysql_close($conn);
?>
</table>
作为检查元素的结果: http://puu.sh/qed4c/7b04611347.png 结果: enter image description here filename:index.php
答案 0 :(得分:1)
您的HTML无效:
echo '<a href="forum/index.php?topic='. $oku->id_topic .'"><td style="font-size:13px;font-weight:bold;"><center><b>';
echo $oku->poster_name;
echo '</b></center></td></a>';
不允许A-tag包裹TD(当然还有更多)。我猜浏览器会自动更正。
答案 1 :(得分:0)
标记A
不是表格的一部分,它将始终放在其中。你不能像这样做一些事情
<table>
<tr>
<a><td></td></a>
</tr>
</table>
您应将A
标记放在TD
或TH
标记内。