如何更改HTML选择箭头颜色?
如何更改下拉箭头的颜色? (相同的样式箭头)
#cars{
width:150px;
}
<!DOCTYPE html>
<html>
<body>
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
</body>
</html>
How to change the color of the dropdown arrow? (Same style arrow)
#cars{
width:150px;
}
<!DOCTYPE html>
<html>
<body>
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您不能简单地更改颜色。删除默认的一个,然后在后台添加您的自定义SVG/图像。
在下面的CSS中,用您的自定义SVG/Image替换背景URL
You cannot simply change the color. Remove the default one and add your custom SVG/image in the background.
In below CSS, replace background URL with your custom SVG/image
这可能取决于您正在查看的浏览器,但是通常您只需要将
color
属性设置为所需的颜色即可。This can depend on the Browser you are viewing it in, but usually you only need to set the
color
attribute to your desired color.首先,您无法改变。因此,大多数UI库都会创建包裹选择框的容器,并使用虚拟选择器自定义箭头。
下面的示例可能会有所帮助。
html css clance select select arrow的颜色
To start with the conclusion, you can't change. So most UI libraries create containers that wrap around Select Box, and use virtual selectors to customize arrows.
The example below might help.
HTML CSS Change Color of SELECT ARROW