选择不在Internet Explorer中显示的选项

时间:2013-08-07 19:09:35

标签: html css internet-explorer-8

以下选择选项在Firefox / Chrome中显示正常,但在IE8中则不显示。请帮忙。

<select id = "vehicle" name = "vehicle" class = "vehicleSelect">
<option value = "-1" selected>&nbsp;</option>
<option value = "15">Car</option>
<option value = "16">Bike</option>
<option value = "17">Train</option>
</select>

CSS:

.vehicleSelect
{
    width: 100%;
    height: 100%;
    font: 10px/1.45em "Lucida Grande",Verdana,Arial,Helvetica,sans-serif;
    padding: 3;
    border: 0;
}

1 个答案:

答案 0 :(得分:1)

您正在删除选择框中的标准边框,因此在各种浏览器中自然会显得很奇怪。请考虑删除height: 100%border:0

您也不应在HTML标记属性中添加间距。根据浏览器的不同,它可能会导致各种问题,而且这只是一种很好的做法。

<select id = "vehicle" name = "vehicle" class = "vehicleSelect">

应该是:

<select id="vehicle" name="vehicle" class="vehicleSelect">