填充在选择列表中的Safari和IE中不工作 [英] padding is not working in Safari and IE in select list

查看:97
本文介绍了填充在选择列表中的Safari和IE中不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道为什么我的Safari没有在选择列表中填充?它的工作正常在FF请告诉我该怎么办。是否有与doctype有关的任何问题?

Does any one know why my Safari is not taking padding in select lists? It's working fine in FF please tell me what to do. is there any issue with the doctype?

代码:

<select style="padding-left:15px">
<option>male></option>
<option>female></option>
</select>

我使用以下doctype:

I'm using the following doctype;

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


推荐答案

即使W3规范不禁止选择框,无论什么原因webkit浏览器(Safari,Chrome)不支持它。相反,您可以删除 padding-left ,然后使用 text-indent ,将相同的金额添加到您的选择框 width

Even though the W3 spec doesn't disallow padding in select boxes, for whatever reason webkit browsers (Safari, Chrome) don't support it. Instead, you can remove the padding-left and use text-indent instead, adding the same amount to your select box width.

从您的评论中的例子:

<select id="sexID" name="user[sex]" 
        style="border:1px solid #C1272D;
               width:258px; // 243 + 15px
               text-indent:15px;
               height:25px;
               color:#808080;">

这篇关于填充在选择列表中的Safari和IE中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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