What CSS should I use to get a border around an option tag in both Firefox and IE?

爱⌒轻易说出口 提交于 2019-12-18 09:36:11

问题


Right now I am using the following CSS:

option
{
    border-width: 1px;
    border-style: solid;
}

Which works fine in Firefox but not in IE. I'm not sure if it makes a difference but the option tags are generated by an ASP.NET ListBox control.


回答1:


Unfortunately, the styling of option elements is supported to different degrees by different browsers. Firefox is the only browser which allows you to add a border around options – IE and Chrome won't show a border.

Here's an overview of what styles different browsers support. The only styling you can reliably apply is background and foreground color.




回答2:


Maybe this way it would work?!

border: 1px solid black;

Never had problems with this, could be something else , parent elements and so on...




回答3:


Add a border-color to your declaration.

option
{
    border-width: 1px;
    border-style: solid;
    border-color: #000;
}


来源:https://stackoverflow.com/questions/3452681/what-css-should-i-use-to-get-a-border-around-an-option-tag-in-both-firefox-and-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!