【发布时间】:2014-05-20 10:34:14
【问题描述】:
无法弄清楚如何丢失我在 HTML5 验证器中遇到的这 2 个错误:
第 11 行,第 151 列:由元素 th 建立的范围 2…3 中的表格列没有以它们开头的单元格。 …t-weight:normal;padding:25px 5px 0 25px;overflow:hidden;word-break:normal;">
错误第 11 行,第 151 列:由元素 th 建立的表第 5 列中没有开始的单元格。 …t-weight:normal;padding:25px 5px 0 25px;overflow:hidden;word-break:normal;">
有什么想法吗?
来源:
<table style="line-height: 21.9px; font-size: 14.6px; font-family: arial, helvetica, sans-serif; border-collapse:collapse;border-spacing:0; width:100%; max-width: 550px; background: #fff; margin: 15px auto;box-shadow:0px 0px 25px 1px rgba(19, 44, 54, 0.4);">
<tr>
<th colspan="5" style="font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:25px 5px 0 25px;overflow:hidden;word-break:normal;">
<img src="http://location.com/header.jpg" width="500" height="220" alt="päis" style="border:0;">
</th>
</tr>
<tr>
<td colspan="5" style="font-family:Arial, sans-serif;font-size:14px;padding:8px 25px;word-break:normal;vertical-align: top;"><p style="padding:0 5px; margin: 0; color: #354347;"><strong>Lorem ipsum.</strong><br />
Lorem ipsum</p>
</td>
</tr>
<tr>
<td colspan="3" rowspan="3" style="font-family:Arial, sans-serif;font-size:14px;padding:8px 25px;word-break:normal;vertical-align: top;"><img src="http://location.com/foto-vasak.jpg" width="226" height="160" alt="vasak" style="border:0;"></td>
<td colspan="2" style="font-family:Arial, sans-serif;font-size:14px;padding: 5px 5px !important;word-break:normal;vertical-align: top;"><p style="padding:0 5px; margin: 0; color: #354347;">Lorem ipsum</p>
</td>
</tr>
<tr>
<td colspan="2" style="font-family:Arial, sans-serif;font-size:14px;padding:8px 25px;word-break:normal;vertical-align: top; padding: 5px 5px !important;"><img src="http://location.com/kandideeri.png" alt="kandideeri" width="287" height="57" style="display:block; margin-left: -40px; border:0;">
</td>
</tr>
<tr>
<td colspan="2" style="font-family:Arial, sans-serif;font-size:14px;padding:8px 25px;word-break:normal;vertical-align: top; padding: 5px 5px !important;"><p style="padding:0 5px; margin: 0; color: #354347;">Lorem ipsum <a href="http://location.com/" target="_blank">Lorem ipsum</a>
või <a href="http://location.com/" target="_blank">Lorem ipsum</a></p>
</td>
</tr>
<tr>
<th colspan="5" style="text-align:left; font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding: 10px 5px 0 25px !important; overflow:hidden;word-break:normal;"><a href="http://location.com/" target="_blank">
<img src="http://location.com/logo.jpg" width="215" height="49" alt="logo" style="border:0;"></a><br /><br />
</th>
</tr>
</table>
【问题讨论】:
-
这是完整的表格吗?如果是这样,当您连续拥有最多 2 个时,为什么要使用 5 个列?
-
是的,这是完整的表格,而 colspan="2" 给出了进一步的错误。
-
我在验证 Fiddle 时得到 no table errors,但是您可以在上面的表格中完成 like this - 跟踪您的行和列会更容易(除非您有 5 列在一行未显示)
-
你是对的,colspan="5" 是不必要的。我得到更多错误的原因是因为我只更改了
thcolspan,但没有更改td。谢谢。
标签: html html-table html-validation