简体   繁体   English

选择下拉滚动样式

[英]Select drop-down scroll style

Is there any css way to stylize the scroll of the default select drop-down? 是否有任何CSS方式可以样式化默认选择下拉菜单的滚动? Or it`s better just forgot this and use div , ul , li and some javascript ? 还是最好忘了这个,并使用divulli和一些javascript

<select id="selector">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  ...
</select>

Here is a simple demo , of overflown select and div nearby, where only div has applyed scroll style, as expected 这是一个简单的演示 ,附近有溢出的selectdiv ,如预期的那样,只有div应用了滚动样式

Scrollbar CSS styles are not part of the W3C standard for CSS and therefore most browsers just ignore them. 滚动条CSS样式不是W3C CSS标准的一部分,因此大多数浏览器都将其忽略。 Some browser have a way to style this, but the javascript solution is the best for cross-browser. 某些浏览器可以设置这种样式,但是javascript解决方案是跨浏览器的最佳选择。

You can forgot this beacause they look different in different bowsers and OS. 您可能会忘记这一点,因为它们在不同的Bowerser和OS中看起来有所不同。 You can use some JQuery plugin to replace system elements. 您可以使用一些JQuery插件来替换系统元素。

Check this : https://www.queness.com/post/204/25-jquery-plugins-that-enhance-and-beautify-html-form-elements 检查一下: https : //www.queness.com/post/204/25-jquery-plugins-that-enhance-and-beautify-html-form-elements

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM