gpt4 book ai didi

css - 在 IE 选项中添加 css 样式

转载 作者:太空宇宙 更新时间:2023-11-04 02:03:46 25 4
gpt4 key购买 nike

我想将 css 样式应用于选择列表中的选项。

它在 mozilla firefox 中完美运行,但不适用于 IE 和 chrome。

jsfiddle for IE

<select class="mapField">
<option value="1">This is option 1 of select list</option>
<option value="2">This is option 2 of select list</option>
<option value="3">This is option 3 of select list</option>
</select>

<style>

select.mapField{
width:120px;
}

.mapField option{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: 100px;
}

</style>

提前致谢。

最佳答案

你不能。 <option>由操作系统呈现,而不是 HTML。除了 background-color , colorborder ,通过选项元素的样式对象应用的样式设置将被忽略。您可能可以搜索看起来像 <select> 的插件,但实际上是可以设置样式的 HTML 元素。

关于css - 在 IE 选项中添加 css 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41260435/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com