javascript - 限制 td 之间的空间

标签 javascript html css forms

这是我的 form

如您所见,信息左侧和右侧(输入)之间有很多空间。我如何限制这个空间?

<html><head><title>Create a League</title></head>

<body>

<center><h1>Create a League</h1></center>

<form action="" method="POST">

 <table cellpadding="0" border="0">
   <tr><td >League Name </td>
     <td> <input name="LeagueName" type="text"> </td>
   </tr>
   <tr><td>Number of Members </td>
     <td><input name="Members" type="text"></td>
   </tr>
   <tr><td>League Password </td>
     <td><input name="LeaguePassword" type="password"></td>
   </tr>
   <tr>
     <td colspan=><input name="Agreement" type="checkbox" value="1"> I agree with the terms of service</td>
   </tr>
   <tr>
     <td colspan=""><input type="submit" value="Register" name="action">
     <input type="reset"  value="Reset"></td>
   </tr>
 </table>
</form>


</body>
</html>

最佳答案

将复选框所在单元格的 colspan 修改为 colspan=2,因为如果没有它,带有标签的整个复选框将放置在左列内。更改后,它将分布在两列中,因此带有标签的左侧不必那么宽。

<td colspan=2><input name="Agreement" type="checkbox" value="1"> I agree with the terms of service</td>

关于javascript - 限制 td 之间的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11603344/

相关文章:

javascript - 使用复选框控制文本框禁用或自述文件行为

javascript - 导入lodash的正确方法

html - 表格行 (tr) 分隔和边框

javascript - setInterval 和 setTimeout 不匹配

javascript - 如何使用javascript在h2标签中显示最终结果

html - CSS - 通过父标签设置边框

jquery - 单击时淡入不同的背景图像

javascript - 每次我更新文本区域的值时,由于某种原因它会被默认值覆盖

css - 是否可以不继承 CSS 规则?

html - 如何在另一个div中水平居中div