htmlcsswebkit

text-align: right on <select> or <option>


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.


Solution

  • 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/