如何分别改变不同TD的宽度?意思是,如果我改变 TD 的宽度,列的宽度不会受到影响,而只会影响行。例如:
http://i.imgur.com/XPNG7Gi.png
我怎样才能做到这一点?我已经尝试过分别更改每个 TD 的宽度,但是,当我这样做时,它会更改整个列本身的宽度。
这是我的表的代码:
<table>
<tr>
<td>Name:</td>
<td>
<input type="text" name="user" placeholder="Your Name" maxlength="20">
</td>
</tr>
<tr>
<td>Email Address:</td>
<td>
<input type="text" name="email" placeholder="Your Email Address">
</td>
</tr>
<tr><td>Message:</td></tr>
<tr>
<td colspan="2">
<textarea rows="10" cols="50" name="message" maxlength="500"></textarea>
</td>
</tr>
<tr><td colspan="2"><center><img src="test.php" alt="" /></center></td></tr>
<tr><td style="text-align:right">Enter the Code:</td><td><input id="security_code" name="security_code" type="text" placeholder="Enter the Code Above"/></td></tr>
</table>
最佳答案
您不能用表格做您想做的事。表格的整体思想是 TD
彼此保持对齐。
如果您想这样做,请放弃使用表格,而只需使用带有输入元素的标签,如下所示:
<label>Name: <input type="text" name="user" placeholder="Your Name" maxlength="20"></label>
<label>Email Address: <input type="text" name="email" placeholder="Your Email Address"></label>
<label> Message: <textarea rows="10" cols="50" name="message" maxlength="500"></textarea></label>
关于html - 在 HTML 表格中单独编辑 TD 的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20435555/