如何更改选择框下拉列表中的蓝色高亮的颜色 [英] How to change colour of blue highlight on select box dropdown

查看:2862
本文介绍了如何更改选择框下拉列表中的蓝色高亮的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改此下拉菜单中的蓝色突出显示?

How do I change the blue highlight on this dropdown please?

链接到选择框演示

以下是代码: -

<html>
<head>
<title></title>

<style>
select { border:0; color:#EEE; background:transparent;
font-size:20px; font-weight:bold; padding:2px 10px; width:378px;
*width:350px; *background:#58B14C; -webkit-appearance: none; }

#mainselection { overflow:hidden; width:350px;
-moz-border-radius: 9px 9px 9px 9px;
-webkit-border-radius: 9px 9px 9px 9px;
border-radius: 9px 9px 9px 9px;
box-shadow: 1px 1px 11px #330033;
background: url("http://www.danielneumann.com/wp-content/uploads/2011/01/arrow.gif") no-repeat scroll 319px 5px #58B14C; 
}
</style>

</head>
<body>

    <div id="mainselection">
    <select>
    <option>Select an Option</option>
    <option>Option 1</option>
    <option>Option 2</option>
    </select>
    </div>
</body>
</html>

如果可能,我想将突出显示颜色更改为灰色。

I'd like to change the highlight color to gray if this is possible.

推荐答案

我相信你正在寻找大纲 CSS属性psuedo属性):

I believe you are looking for the outline CSS property (in conjunction with active and hover psuedo attributes):

/* turn it off completely */
select:active, select:hover {
  outline: none
}

/* make it red instead (with with same width and style) */
select:active, select:hover {
  outline-color: red
}

style和outline-width
https://developer.mozilla.org/en- US / docs / Web / CSS / outline

Full details of outline, outline-color, outline-style, and outline-width https://developer.mozilla.org/en-US/docs/Web/CSS/outline

这篇关于如何更改选择框下拉列表中的蓝色高亮的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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