如何从选择标签更改选项的背景颜色? [英] How can I change the background color of option from select tag?
本文介绍了如何从选择标签更改选项的背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从选择标签中更改选项的背景颜色.
I am trying to change the background colour for option from the select tag.
我尝试了 select>选项
,但无效.
我的下面的代码:
select {
width: 100%;
height: 32px;
background-image: url("images/2017_04_form_select.jpg");
padding-right: 25px;
/* Safari 3-4, iOS 1-3.2, Android 1.6- */
-webkit-border-radius: 0;
/* Firefox 1-3.6 */
-moz-border-radius: 0;
/* Opera 10.5, IE 9, Safari 5, Chrome, Firefox 4, iOS 4, Android 2.1+ */
border-radius: 0;
background-repeat: no-repeat;
background-position: right center;
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
border: 1px solid #bdb9bb;
margin-bottom: 20px;
}
select:-moz-focusring {
color: transparent;
text-shadow: 0 0 0 #000;
}
select::-ms-expand {
display: none;
}
select>option {
background: #e8e4e6;
}
推荐答案
您是否尝试过 select.option
吗?
或者只是 option
吗?
这篇关于如何从选择标签更改选项的背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文