最佳答案
在表单上,我有一个选择和两个输入字段。这些元素是垂直对齐的。不幸的是,我无法得到这些元素的等宽度。
这是我的密码:
<select name="name1" style="width:198px">
<option>value1</option>
<option>value2</option>
</select><br/>
<input type="text" name="id1" style="width:193px"><br/>
<input type="text" name="id2" style="width:193px">
For above example, the best width for select element is 198 or 199 px (of course I tried 193px, but the difference is major). I think, it depends on resolution, on various computers and browsers since these elements don't have equal widths (sometimes I thinks difference is about 1 or 2 px). I've tried to set these elements in div or table rows, but it doesn't help.
问: 怎样才能精确地得到这些元素的宽度相等?