【发布时间】:2018-06-28 17:01:41
【问题描述】:
我找到了一些很好的解决方案来改变下拉框中项目的颜色:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
select option:hover,
select option:focus,
select option:active {
background-color: lightpink !important; /* for IE */
color: #ffed00 !important;
}
select option:checked {
background-color: green !important; /* for IE */
color: #000000 !important;
}
</style>
</head>
<body>
<select>
<option>Item 1</option>
<option>Item 2</option>
<option>Item 3</option>
<option>Item 4</option>
</select>
</body>
</html>
这适用于下拉框(确实有些奇怪的颜色):
选择后,突出显示的项目的背景仍然默认为蓝色:
我还能做些什么来改变这种颜色?
【问题讨论】:
标签: html css drop-down-menu highlight