CSS for the “down arrow” on a <select> element?

后端 未结 11 950
你的背包
你的背包 2020-12-01 02:07

Is it possible to stylize the down arrow on a drop down select element? i.e., ()

I suspe

相关标签:
11条回答
  • 2020-12-01 02:49

    No, the down arrow is a browser element. It's built in [and different] in every browser. You can, however, replace the select box with a custom drop down box using javascript.

    Jan Hancic mentioned a jQuery plugin to do just that.

    0 讨论(0)
  • 2020-12-01 02:50

    You can't style combos very well using CSS.

    The guys at FogBugz made a pretty good custom combo using JavaScript, so it is possible, it just takes a lot of work to get it right.

    Better to stick with the standard one for version 1, then see if it's worth updating it once your app is in the wild.

    0 讨论(0)
  • 2020-12-01 02:52

    I don't know if it is stylable with CSS (probably not in IE), but please: do not use a "fake" drop-down box using javascript, because the usability of these things usually is horrible. Among other things, keyboard navigation is usually absent.

    0 讨论(0)
  • 2020-12-01 02:53

    Maybe you can use jQuery selectbox replacement. It's a jQuery plugin.

    0 讨论(0)
  • 2020-12-01 02:53

    There's a cool CSS-only solution to styling dropdowns here: http://bavotasan.com/2011/style-select-box-using-only-css/

    Basically, wrap the select in a container div, style the select to be 18px wider than the container with a transparent background, give overflow:hidden to the container (to chop off the browser-generated arrow), and add your background image with stylized arrow to the container.

    Doesn't work in IE7 (or 6), but seriously, I say if you're using IE7 you deserve a less-pretty dropdown experience.

    0 讨论(0)
提交回复
热议问题