gpt4 book ai didi

html - 填充在选择列表中的 Safari 和 IE 中不起作用

转载 作者:技术小花猫 更新时间:2023-10-29 12:09:34 24 4
gpt4 key购买 nike

有谁知道为什么我的 Safari 没有在选择列表中填充?它在 FF 中运行良好,请告诉我该怎么做。文档类型有问题吗?

代码:

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

我正在使用以下文档类型;

<!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

从您评论中的示例:

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

关于html - 填充在选择列表中的 Safari 和 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2966855/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com