简体   繁体   English

如何将表单选择上的下拉按钮移到左侧?

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

I have an html dropdown: 我有一个HTML下拉列表:

<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? 希望有一些不错的HTML或CSS可以解决这个问题?

Given the following HTML 鉴于以下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 您可以使用以下CSS

#mySelect{ direction: rtl; #mySelect {方向:rtl; } }

jsiddle jsiddle

Yes you can use direction right to left to move the arrow to the left. 是的,您可以使用right to left direction将箭头right to left移动。

  select { direction: rtl; }

Demo 演示

rtl : Text and other elements go from right to left rtl:文本和其他元素从右到左

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. 请记住,这会将样式应用于所有选择元素,因此您可以使用id或class来应用于特定的选择元素。

HTML 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 CSS

.reverse
{ 
  direction: rtl; 
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM