您需要在选项标记上放置background-color,而不是选择标记…
select option {
margin: 40px;
background: rgba(0, 0, 0, 0.3);
color: #fff;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
如果你想为每个选项标签样式。使用css属性选择器:
select option {
margin: 40px;
background: rgba(0, 0, 0, 0.3);
color: #fff;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
select option[value="1"] {
background: rgba(100, 100, 100, 0.3);
}
select option[value="2"] {
background: rgba(200, 200, 200, 0.3);
}