简体   繁体   English

停止选择框以更改所选选项颜色

[英]Stop select box from changing selected option color

I have a drop down that I have styled with and image. 我有一个我用它和图像风格的下拉菜单。 When user selects an option it turns blue. 当用户选择一个选项时,它变为蓝色。 The blue color shows on top of the image which looks really ugly. 蓝色显示在图像的顶部,看起来非常难看。 How can I stop this behaviour through css?? 我怎么能通过CSS停止这种行为? I dont want the selected state to change color. 我不希望所选状态改变颜色。

I want something like 我想要类似的东西

select:active {
    background:transparent;
}

I am open to javascript solution too... 我也对javascript解决方案持开放态度......

There is no agreed-upon, cross-browser, standards-compliant solution to styling a selected option from a select box. 没有商定的跨浏览器,符合标准的解决方案,可以从选择框中选择样式。

Every browser handles input fields differently and that is most-true when working with select fields. 每个浏览器处理输入字段的方式不同,在使用选择字段时最为正确。

Your best bet will be to check out this question/answer: Is it possible to style a select box? 你最好的选择是查看这个问题/答案: 是否可以设置选择框的样式?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM