2014-01-21 53 views
0
<select id="selectId" name="name1" style="height:10% !important;" > 
    <option>Select One</option> 
    <option>xxx</option> 
    <option>yyy</option> 
    <option selected="selected">rrr</option> 
    <option>ggg</option> 
    <option>fff</option> 
    <option>qqq</option> 
</select> 

如何設置選擇的寬度和高度。我正在使用jQuery的移動CSS,我無法做到這一點。請幫我Jquery Mobile - 如何覆蓋選擇框的高度和寬度。

在此先感謝

回答

1

您需要更改這個CSS類.ui-select試試這個:

.ui-select{ 
    width:200px; 
    height:70px; 
} 

檢查Demo

如果你想以影響只有選擇使用ID來定位像這樣在JQuery中:

$(document).ready(function(){ 
    $('#selectId').closest('.ui-select').addClass('select_small') 
}) 

有了這個,你可以添加這個類:

.select_small{ 
    width:200px; 
    height:70px; 
} 

檢查另一個DEMO

+0

感謝它幫助我,但你能告訴我如何應用這隻適用於一個特定的選擇它適用於所有頁面.. –

+0

高度不工作 –

+0

你可以使用JQuery來做到這一點。檢查編輯@ user3185790 – DaniP

0

嘗試指定確切的高度,如100像素,或者如果你希望它是用百分比,請確保您的容器具有高度爲好。

<select id="selectId" name="name1" style="height:100px !important;" > 

http://jsfiddle.net/F2952/

這個運行。

0

如果你堅持使用jquery爲此,你可以使用

$("#selectId").width("enter your width"); 
$("#selectId").height(enter your height); 
0

select的高度似乎是依賴於options。所以,我會這樣寫:

select option{height:50px} 

Demo here

相關問題