Padding doesn't work on select tags in Safari [duplicate]

二次信任 提交于 2019-12-30 17:36:27

问题


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 {
  padding: 6px;
}

On IE7, I understand, but on Safari? Is there a way to get around this?


回答1:


Answered previously here: 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.

Here's an example: http://jsfiddle.net/B858P/



来源:https://stackoverflow.com/questions/9615071/padding-doesnt-work-on-select-tags-in-safari

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