添加填充以选择选项 [英] Adding padding to select options

查看:98
本文介绍了添加填充以选择选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在使用css的html的选择选项之间添加一些空格(填充,边距或其他)。我已经尝试使用类似:

I want to add some kind of space(padding, margin or whatever) between select options in html using css. I've already tried using something like:

 select option {
     padding:10px
 }

但它不工作。我已经阅读,这是可能的,但它不工作在IE。

however it didn't work. I've already read that this is possible to do but it does not work in IE. Anyway, i'd like to have this to work in other browsers even if it doesn't work in IE.

PS:目前使用Chrome

PS: currently using Chrome

JSFiddle示例

推荐答案

样式选择选项非常有限,因为在操作系统中的所有应用程序之间保持一致性和一致性,因此浏览器应该限制一些基本元素的样式,如在您的case选项

styling to select option is very much limited as to maintain a coherence and consistency among all the application in the operating system thus the browser are ought to restrict the style of some basic elements like in your case option tag.

限制取决于浏览器对浏览器,例如padding,甚至选项标签的边距在mozilla firefox中工作,但不适用于chrome。

The restriction depends browser to browser, like padding and even margin of option tag works in the mozilla firefox while it doesn't works with chrome.

如果在你的网站中非常有必要设置选项标签的样式,那么我建议你使用一些jQuery插件(你也可以自己下载,它简单)。

If it is very much necessary in you website to style the option tag then I suggest you to use some jQuery plugin (you can also make a drop down of your own, its simple).

这篇关于添加填充以选择选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆