更改< select>高亮颜色 [英] Changing <select> highlight color

查看:268
本文介绍了更改< select>高亮颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改< select> 的突出显示颜色,突出显示< li> c>< li> ,但它听起来像是要更改< option> 元素的背景颜色。



如果你想突出显示整个< select> 元素在鼠标悬停,这种工作:

  select:hover {background-color:red; } 

然而,在不同的浏览器中行为是不同的。例如,Chrome不会突出显示下拉列表中的选项; Firefox,但是它不会改变他们回来,如果你移动鼠标,他们仍然被拉下来。



正如许多人所说,许多类似的问题,您不能可靠地设置样式表单控件详情请参阅这里


How do I change the highlighting color of <select> that is the color that highlights <li> while cursor passes over it by using CSS?

解决方案

No idea what you mean about "the color that highlights <li>", but it sounds like you want to change the background colour of <option> elements. I tried it and it doesn't work, you always get the system color.

If you wanted to highlight the entire <select> element on mouseover, this kinda works:

select:hover { background-color: red; }

However the behaviour is different in different browsers. For example, Chrome doesn't highlight the options in the drop down; Firefox does, but then it doesn't change them back if you move the mouse away and they are still pulled down.

As has been stated on many, many similar questions, you can't reliably style form controls. See here for more details.

这篇关于更改&lt; select&gt;高亮颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆