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!
Align a Paragraph To align left, press Ctrl + L. To align right, press Ctrl + R. To align center, press Ctrl + C. To justify, Ctrl + J.
Right alignment should be used sparingly at best, as right alignment isn't good for user experience and readability. There are some rare cases that it can actually make sense if used in low uses, like in this modern business letterhead example.
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With