我正在使用jQuery UI來製作搜索表單。 我能夠得到我想要的結果,直到我嘗試將我的表單右側的select
菜單與CSS
對齊。CSS浮動:權利不能在JQuery UI選擇菜單上工作
下面是我想要做的簡化版本:https://jsfiddle.net/z829pay7/15/。
和下面的對應代碼:
HTML代碼
<form action="/" method="get" >
<input type="button" id ="button3" value="Button3" class="button left"/>
<input type="button" id ="button2" value="Button2" class="button right"/>
<input type="button" id ="button1" value="Button1" class="button right"/>
<select name="select" id="select" class="select">
<option>Option 1</option>
<option>Option 2</option>
</select>
</form>
JavaScript代碼
$(".select").selectmenu({
width:200
});
$(".button").button();
CSS代碼
.right {
float:right;
clear:left;
}
.button {
vertical-align : middle;
}
.select {
float: right;
vertical-align:middle;
}
我在jQuery UI按鈕上使用float:right
,它按預期工作。 在select
菜單CSS似乎被忽略。
我也找不到垂直對齊buttons
和select
菜單的方法。
請讓我知道我做錯了什麼!
編輯(2015/08/31 13:17):我更新了小提琴鏈接。
選擇菜單,因爲它隱藏與顯示不採取CSS:無 – Rahul
@philippe這算什麼,你期待[小提琴] (https://jsfiddle.net/Kri4shna/fw40o1r8/2/) – Webruster
林'對不起,它看起來像我忘了保存我的JSfiddle!我有理由編輯它:https://jsfiddle.net/z829pay7/15/。 @Webruster,我期望的是讓我的菜單在屏幕的右側對齊,但在Button1的左側。理想情況下,它應該具有相同的尺寸,並與按鈕垂直對齊。 – Philippe