【发布时间】:2013-12-07 01:00:44
【问题描述】:
据我所知,没有解决方案可以在所有现代浏览器中的选择框(下拉菜单)中获得一致的左内边距。
<select class="dropdown">
<option>Planes</option>
<option>Trains</option>
<option>Automobiles</option>
</select>
我听说的解决方案是使用文本缩进,但这在 Firefox 中完全中断,更不用说在其他浏览器中偶尔支持。如果您使用组合,您实际上会在所有主要浏览器中获得完全不同的结果。
.dropdown {
padding-left: 10px;
text-indent: 10px;
}
IE:仅填充呈现
Chrome:两者渲染
Safari:仅文本缩进呈现
Firefox:填充,带有奇怪的文本缩进 bug
还有其他方法可以解决此问题吗?似乎最好的方法是放弃 text-indent 并尝试找出一种在没有它的情况下在 Safari 中缩进的方法,因为其他所有东西都可以很好地处理填充。
【问题讨论】:
-
这里[使用选择选项居中对齐文本][1] [1]:stackoverflow.com/questions/10028788/…
-
你可以在这里看到 [Center Align Text with Select Option][1] [1]: stackoverflow.com/questions/10028788/…
-
如何使用选择选项垂直对齐文本。 [使用选择选项居中对齐文本][1] [1]:stackoverflow.com/questions/10028788/…
标签: javascript jquery html css