【发布时间】:2013-02-06 00:56:49
【问题描述】:
我的网站上有以下页面:
我通过在它们周围添加两列定义宽度来使这两列居中:
<table class="form">
<tbody>
<tr>
<td style="width:20%;"></td>
<th>User ID</th>
<td><input type="text" name="userid" id="userid" class="medium" value="" /></td>
<td style="width:20%;"></td>
</tr>
<tr>
<td></td>
<th>Password</th>
<td><input type="password" name="password" id="password" class="medium" /></td>
<td></td>
</tr>
<tr>
<td></td>
<th><label for="remember">Remember my user ID</label></th>
<td><input type="checkbox" name="remember" id="remember" value="true" /></td>
<td></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="3"><a href="forgot/">Forgot your user ID or password?</a></td>
<td><input type="submit" name="submit" id="submit" value="Login" /></td>
</tr>
</tfoot>
</table>
有没有什么方法可以做到这一点,而侧面的两个空列的宽度为 20%?
【问题讨论】:
-
OT:请将
role="presentation"添加到您的<table>标签中,因此辅助技术不会将其视为普通桌子,此处不需要<tfoot>,并且使用不当跨度>
标签: html css html-table centering