【发布时间】:2018-06-24 15:59:19
【问题描述】:
我有这个 html 表格:
<fieldset class="form login">
<legend>Authorization</legend>
<table>
<tbody>
<tr>
<td colspan="1">
<label class="form__label" for="login">Login</label>
</td>
<td colspan="3">
<input id="login" type="email" required="required">
</td>
</tr>
<tr>
<td colspan="1">
<label class="form__label" for="password">Password</label>
</td>
<td colspan="3">
<input id="password" type="password" required="required">
</td>
</tr>
<tr>
<td class="text-center" colspan="4"><input type="submit"></td>
</tr>
</tbody>
</table>
</fieldset>
当我通过验证器 (validator.w3.org) 运行它时,我得到一个错误:
Error: Table columns in range 3…4 established by element td have no cells beginning in them.
From line 21, column 16; to line 22, column 26
</td>↩ <td colspan="3">↩
这是什么意思?
我找到了这个答案:
Help with HTML validation error: Table column has no cells beginning in it
但仍然不明白我必须做什么才能使其有效?
【问题讨论】:
-
可能是因为您想要跨越的列数少于表中的列数。尝试扩大减少colspan值的表格
-
将 colspan 3 减少到 2 - 不起作用,事实上,会出现更多错误:表格行宽 4 列,超过了第一行 (3) 建立的列数。
标签: html html-table w3c-validation