Html 填充对 Safari 中的选择标签不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9615071/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Padding doesn't work on select tags in Safari
提问by catandmouse
Possible Duplicate:
padding is not working in Safari and IE in select list
So I have a basic select tag like so:
所以我有一个基本的选择标签,如下所示:
<select>
<option>1</option>
<option>2</option>
<option>2</option>
</select>
But if I put padding on select tag, it doesn't work on Safari:
但是如果我在 select 标签上放置填充,它在 Safari 上不起作用:
select {
padding: 6px;
}
On IE7, I understand, but on Safari? Is there a way to get around this?
在 IE7 上,我明白,但在 Safari 上?有没有办法解决这个问题?
回答by Andreas Eriksson
Answered previously here: https://stackoverflow.com/a/2967371/181002
以前在这里回答:https: //stackoverflow.com/a/2967371/181002
Webkit has taken it upon itself to disallow padding for select
-items, but you can achieve the same effect by using a simple 'hack', consisting of applying line-height
and text-indent
to your selectitem.
Webkit 已经自行决定禁止对select
-item进行填充,但是您可以通过使用简单的“hack”来实现相同的效果,包括将line-height
和text-indent
应用于您的选择项。
Here's an example: http://jsfiddle.net/B858P/
这是一个例子:http: //jsfiddle.net/B858P/