简体   繁体   English

选择框选项的边框底部不适用于chrome

[英]Border bottom for select box option not working on chrome

I would like to underline the disabled options on a select box. 我想在select框上underline禁用的选项。 See my code, 看我的代码,

CODE

 #myselect option { font-size: 13px; color: #1A1F24; } #myselect option:disabled { font-size: 11px; color: #ABB6C0; border-bottom: 1px solid #ABB6C0; } 
 <select id="myselect"> <option value="1">One</option> <option value="2" disabled>Two</option> <option value="3">Three</option> <option value="4">Four</option> </select> 

This code works fine in firefox. 这段代码在firefox中工作正常。 Not working in chrome. 没有使用chrome。 How to make work this in chrome too ? 如何在chrome中完成这项工作?

JS Fiddle JS小提琴

According to this Article from ElectricToolbox , border it isn't a property that you can style in select / option / optgroup when using Chrome. 根据ElectricToolbox的这篇文章border不是你在使用Chrome时可以在select / option / optgroup样式的属性。

Here is the properties you can style: 以下是您可以设置样式的属性:

  • font-style
  • font-weight
  • color
  • background-color
  • font-family
  • font-size
  • padding

Note : that some of these properties above only work for one the elements, for example, padding only will work in select 注意 :上面的一些属性仅适用于一个元素,例如, padding仅适用于select

If you want to customize selects you may want to try some of the selects plugins out here, like : 如果你想自定义selects你可能想在这里尝试一些选择插件,如:

It looks like you can only use borders for option elements in Firefox as per this . 它看起来像你只能用边框option在Firefox中的元素按照这个

You would need to create a custom drop down list control to achieve a universal solution. 您需要创建自定义下拉列表控件以实现通用解决方案。 Check out Custom Drop-Down List Styling for some examples. 有关示例,请查看自定义下拉列表样式

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

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