select 文字右对齐

1、添加 dir 属性,适合中文,但是会导致英文单词或者有空格的地方文字变成从右到左。
<select dir="rtl">
    <option>Foo</option>    
    <option>bar</option>
    <option>to the right</option>
</select>

2、使用 css ,这个方法是比较靠谱的,建议使用

select {
    direction: rtl;
}
select option {
    direction: ltr;
}

 

参考:http://stackoverflow.com/questions/7920677/text-align-right-on-select-or-option

 

posted on 2015-04-22 10:59  孤云独去闲  阅读(25730)  评论(0编辑  收藏  举报

导航