如何从选择标签更改选项的背景颜色?
问题描述:
我正在尝试从选择标签中更改选项的背景颜色.
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
吗?