【发布时间】:2010-02-10 12:59:28
【问题描述】:
select 字段具有相同的大小属性,但 options 具有具有特定填充的类(都是同一个类)。但是,如果没有 option 元素,则空的选择字段现在具有不同的长度。
+-------------+ +-------------+
| foo | +---+ | |
| bar | | > | | |
| baz | +---+ | |
| | | |
| | +---+ | |
| | | < | | |
| | +---+ | |
| | +-------------+
+-------------+
HTML
<style type="text/css">
select option {padding:1px;}
</style>
<select size="10" style="width:100px;">
<option>foo</option>
<option>bar</option>
<option>baz</option>
</select>
[...]
<select size="10" style="width:100px;">
<!-- empty yet -->
</select>
连接后(第二个select 字段中出现了一个新选项)高度交换为与第一个相同的长度
+-------------+ +-------------+
| foo | +---+ | baz |
| bar | | > | | |
| | +---+ | |
| | | |
| | +---+ | |
| | | < | | |
| | +---+ | |
+-------------+ +-------------+
在不为两个select 字段指定绝对高度的情况下解决此问题的任何想法?
【问题讨论】: