【问题标题】:Set color of multiple select box option when select box is focused选择框聚焦时设置多个选择框选项的颜色
【发布时间】:2015-08-16 10:04:31
【问题描述】:

我正在尝试设置<option> 标签的样式,以便在选择选项时基本上没有样式。原因是它是“duallist box”所以我真的不需要样式。

I've been able to set the background color (white) but when the select menu is focused, it sets the color of the options text to white as well.

我尝试在选择菜单和选项上设置颜色。我试过使用伪选择器。我在selectoption 标签上都尝试过内联样式。我似乎无法弄清楚。这显然是可能的,因为该链接具有我正在寻找的功能,尽管类似的 css 在我的应用程序中似乎不起作用。

如果有帮助,我会将 Wordpress 管理部分中的自定义字段设置为插件。除了这种风格,一切都正常。

目前也在 Chrome 上。虽然最终最好使用跨浏览器解决方案。

这是我尝试过的一些规则。除了使用类、id 和内联样式:

table select option,
table select option:hover,
table select option:focus,
table select option:active,
table select option:checked
{
    background: linear-gradient(#fff,#fff); /* works */
    color:red; /* does not work */
}

table select,
table select:focus,
table select:focus option,
table select:focus option:checked
{
    color:red; /* does not work */
}

更新

问题似乎出在带有selected="selected" 的选项上。 Here's a fiddle.

【问题讨论】:

    标签: css wordpress


    【解决方案1】:

    提供一个 ID ex:选择您的选项并尝试如下 css

    select option#opt {Background.:red;} 
    

    【讨论】:

    • 没有骰子。此外,我的背景颜色工作正常。这是文本颜色。
    • 然后给颜色 :red;在上面的css中
    猜你喜欢
    • 1970-01-01
    • 2017-03-06
    • 1970-01-01
    • 2011-06-08
    • 2020-07-16
    • 1970-01-01
    • 2012-10-01
    • 1970-01-01
    • 2018-04-01
    相关资源
    最近更新 更多