选择和选项样式 [英] Select and Options Styling
本文介绍了选择和选项样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何设计选择选项?我想在下拉菜单中选择交替的背景颜色。
How to style the select options? I want alternating background colors in the drop down menu.
推荐答案
就像任何其他元素一样
option:nth-child(even) {
background-color: red;
}
option:nth-child(odd) {
background-color: blue;
}
如果您需要支持不支持 nth-child
您需要使用一个类。
If you need to support browsers that don't support nth-child
you'll need to use a class.
某些浏览器不支持样式选项
s(猜猜是哪些)。
Some browsers don't support styling option
s at all (guess which ones).
这篇关于选择和选项样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文