Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I move the dropdown button on a form select to the left side?

Tags:

html

css

forms

I have an html dropdown:

<form>
<select>
<option value="1">Client: Zac Brown Band</option>
<option value="2">Saab</option>
<option value="3">Mercedes</option>
<option value="4">Audi</option>
</select>
</form>

I would like to know if there is any possible way to move the little down arrow box to the left side of the list instead of the right? Hopefully there is some nice html or css that will do the trick?

like image 669
user2434938 Avatar asked Dec 06 '25 14:12

user2434938


2 Answers

Given the following HTML

<select id="mySelect">
<option value="1">Client: Zac Brown Band</option>
<option value="2">Saab</option>
<option value="3">Mercedes</option>
<option value="4">Audi</option>
</select>

you can use the following CSS

#mySelect{ direction: rtl; }

jsiddle

like image 157
isJustMe Avatar answered Dec 08 '25 06:12

isJustMe


Yes you can use direction right to left to move the arrow to the left.

  select { direction: rtl; }

Demo

rtl : Text and other elements go from right to left

See direction reference.

Remember this will apply style on all select elements so you can use either id or class to apply to the specific select elements.

HTML

<select class="reverse">
<option value="1">Client: Zac Brown Band</option>
<option value="2">Saab</option>
<option value="3">Mercedes</option>
<option value="4">Audi</option>
</select>

Css

.reverse
{ 
  direction: rtl; 
}
like image 20
PSL Avatar answered Dec 08 '25 06:12

PSL



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!