更新时间:2022-12-02 10:42:04
对不起.恐怕这是不可能的.问题是<select>
下拉菜单使用浏览器的本机下拉菜单渲染.这意味着样式功能有限,并且因浏览器而异.我也看到了您在OSX Chrome上描述的行为-在选择框下方未打开.
Sorry. I'm afraid this is not possible. The problem is <select>
dropdowns uses browser's native rendering of dropdowns. This means that there is limited styling capability and differ by browsers. I see the behavior you described on my OSX Chrome as well - not opening below the select box.
您可以完全完全控制样式的唯一方法是使用完全自定义的内容-使用DOM和javascript构建<select>
:
The only way you can have complete control the styles completely is to use something completely custom - building the <select>
using DOM and javascript:
查看以下内容: http://gregfranko.com/jquery.selectBoxIt.js/
选择库时,请确保选择一个将本机<select>
标记转换为自定义的库-IE标记不应针对您的HTML自定义.这样一来,当浏览器没有JavaScript时,您的<select>
下拉列表仍应起作用
When selecting a library, make sure to pick one that transforms the native <select>
tag into custom - IE the markup shouldn't be custom for your HTML. This is so when browsers don't have JavaScript, your <select>
dropdown should still work