简体   繁体   English

更改所选选项的颜色(选中时)

[英]change the selected option color (while its selected)

When an option is selected (regardless of its color or background color), it's background will be set to blue and the font color to white. 选择一个选项时(无论其颜色还是背景颜色),其背景将设置为蓝色,字体颜色设置为白色。 How to change these behaviors? 如何改变这些行为? Say I want to set the font color to red, while an option is selected. 说我想在选择一个选项的同时将字体颜色设置为红色。

[updated] [更新]

As far as I know, you cannot do that because it is not rendered in the browser. 据我所知,您无法执行此操作,因为它未在浏览器中呈现。 this is rendered by the OS. 这是由操作系统呈现的。 so if you want that badly, build your own or use other libraries' menus like Jquery UI's .. 因此,如果您非常需要此功能,请构建自己的菜单或使用其他库的菜单,例如Jquery UI的..

Read this 读这个

Example (using jquery ui set your css to this while using menus): 示例(使用jquery ui在使用菜单时将css设置为此):

.ui-widget-content .ui-state-focus{
    color:red;
    background-color:lime;
    background-image:none;
    background-repeat:no-repeat;
}

DEMO 演示

Or just customize the library from HERE (preferable) 或者只是从此处自定义库(首选)

check THIS to know how to use Jquery ui menus 检查以了解如何使用Jquery ui菜单

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

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