text-align:right on< select>或< option> [英] text-align: right on <select> or <option>

查看:164
本文介绍了text-align:right on< select>或< option>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道是否可以将文本对齐到< select> 或更具体地< option> 元素 WebKit 。这不需要是一个跨浏览器的解决方案,包括IE,但应该是纯CSS如果可能。



我试过两个:



select {text-align:right} 选项{text-align:right} ,但是似乎在WebKit(Chrome,Safari或Mobile Safari)中都无效。



任何帮助非常感谢!

 < select dir =rtl> 
< option> Foo< / option>
< option> bar< / option>
< option>在右侧< / option>
< / select>

此处演示: http://jsfiddle.net/fparent/YSJU7/


Does anyone know if it's possible to align text to the right of a <select> or more specifically <option> element in WebKit. This does not need to be a cross-browser solution including IE, but should be pure CSS if it is possible.

I have tried both:

select { text-align: right } and option { text-align: right }, but neither seems to have worked in WebKit (either Chrome, Safari or Mobile Safari.

Any help gratefully received!

解决方案

You could try using the "dir" attribute, but I'm not sure that would produce the desired effect?

<select dir="rtl">
    <option>Foo</option>    
    <option>bar</option>
    <option>to the right</option>
</select>

Demo here: http://jsfiddle.net/fparent/YSJU7/

这篇关于text-align:right on&lt; select&gt;或&lt; option&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆