如何设置<option>的背景颜色?在<选择>元素? [英] How can I set the background color of <option> in a <select> element?
本文介绍了如何设置<option>的背景颜色?在<选择>元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何设置 HTML 列表中项目的背景颜色?
How do you set the background color of an item in an HTML list?
推荐答案
select.list1 option.option2
{
background-color: #007700;
}
<select class="list1">
<option value="1">Option 1</option>
<option value="2" class="option2">Option 2</option>
</select>
这篇关于如何设置<option>的背景颜色?在<选择>元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文