选择选项的水平文本中心 [英] Horizontally text center for select option
本文介绍了选择选项的水平文本中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用标准的< select> $ c这个简单的小提琴 $ c> html元素,所有我试图做的是为
< option>
标签提供中心对齐。
我已经试过 text-indent:20px
,但它的中心只有select中的可见标记!
感谢您的帮助。解决方案1: (一个简单的解决方案)
select {
...
padding:0 0 0 20px;
}
解决方案2: (已添加27-10-2017)
只有选定的号码将居中。
* 可能尚未被Safari支持
select {
...
text-align:center;
text-align-last:center;
}
I have this simple fiddle with standard <select>
html element, all what am trying to do is give center alignment for <option>
tags.
I've tried already text-indent: 20px
but its center only the visible tag in the select!
Will be thankful for any help.
解决方案
Solution 1: (A simple solution)
select {
...
padding: 0 0 0 20px;
}
Solution 2: (added 27-10-2017)
Only the selected number will be centered.
* Probably not yet supported by Safari
select {
...
text-align: center;
text-align-last: center;
}
这篇关于选择选项的水平文本中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文