gpt4 book ai didi

html - 为 Internet Explorer 和 Firefox 选择菜单箭头样式

转载 作者:太空宇宙 更新时间:2023-11-04 00:13:56 24 4
gpt4 key购买 nike

这是用于为选择列表使用自定义箭头的样式,但它在 IE 和 Mozilla Firefox 中不起作用。是否有任何黑客/解决方案?

select{
-webkit-appearance:none; -moz-appearance:none !important;
border-radius:4px ; border:#cccccc solid 1px ;
height:26px; width:210px; padding-left:8px;
font:normal 14px Myriad Pro, Verdana, Geneva, sans-serif; color:#7f7f7f;
background-image:url(../images/list_arrow.jpg); background-position:185px; background-repeat:no-repeat;
}

最佳答案

我不知道用于 IE 的纯 CSS 解决方案,但是您可以为 Firefox 做的事情是用另一个元素覆盖 select 的箭头(只是箭头!)背景是您的自定义箭头,并在该元素上使用 pointer-events: none(这也适用于 Chrome 和 Safari)。

DEMO

HTML:

<select>
<option>item 1</option>
<option>item 2</option>
<option>item 3</option>
</select>
<div class='arrow'></div>

CSS:

select, .arrow { display: inline-block; vertical-align: middle; }
option { padding: 0 1em; }
.arrow {
width: 26px;
height: 26px;
margin-left: -28px;
display: inline-block;
background: url(arrow.png);
background-size: 100% 100%;
pointer-events: none;
}

对于IE,也可以覆盖select的箭头,在覆盖箭头的元素上添加点击监听器,当点击箭头时打开select。这实际上适用于任何浏览器,但它涉及 JavaScript。

关于html - 为 Internet Explorer 和 Firefox 选择菜单箭头样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12054134/

24 4 0
文章推荐: python - 矩阵操作 : Subtract 2D Matrix and 3D Matrix in numpy
文章推荐: python - Python3 中的字典帮助
文章推荐: python - 在 iterrows 不一致行为期间修改数据框
文章推荐: html - 重新定位 HTML