我有这个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
但是仍然不明白我到底要做什么才能使它有效?
发布于 2018-06-25 00:45:28
行1:行2:行3:
第1行:|单元格1,1 |单元格1,2-4 |第2行:|单元格1,1 |单元格1,2-4 |第3行:|单元格1,1-4 |
因此,解决方案是将第1行和第2行中的colspan="3"
替换为colspan="1"
(或者完全删除它,因为colspan="1"
毫无意义),并在第3行中将colspan="4"
替换为colspan="2"
。这样,标记就与表的实际方面对齐了。
https://stackoverflow.com/questions/51011595
复制相似问题