天天看點

select文字右對齊/居中1、添加 2、使用 css ,這個方法是比較靠譜的,建議使用

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;
}