为HTML选择元素设置样式 [英] Styling HTML select element
问题描述
我已经尝试过从SELECT元素中删除默认的向下箭头按钮,但是还是不能成功。
I have tried everything to remove the default down arrow button from the the SELECT element, but couldn't succeed yet.
我也测试了背景图片,显示在默认按钮后面。
I have also tested the background image, that shows behind the default button. And even tried by making NONE as Background, but it's not working for me.
如何设置选择元素的样式,使箭头不出现?
How can I style a select element so the arrow does not appear?
推荐答案
在没有JavaScript解决方法的情况下,不可能在所有浏览器中(可靠地)。更不用说,如果你不小心,它会提供一个坏的UX。我喜欢选择元素的高雅造型的是:
It's impossible to do in all browsers (reliably) without a JavaScript workaround. Not to mention, if you're not careful it will provide a bad UX. The one I prefer for tasteful styling of the select element is:
你只需要编辑sprite看起来像你想要的,它会处理剩下的。
You just need to edit the sprite to look like you want and it'll take care of the rest.
这篇关于为HTML选择元素设置样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!