2011-04-08 71 views
1

可能重複:
adjust the height of the list in dropdown box高度下拉框中顯示的

我如何可以調整名單的高度,在下拉菜單中,因爲我有太多的價值加載到下拉框中。例如,它只顯示10個條目,並用滾動條查看剩餘條目。有誰知道這是怎麼做到的嗎?你可能會更清楚地看到我的照片。


dipaly only 5 options 這就是我想要的。它只顯示5個條目,並用滾動條查看剩餘條目。

+2

你剛纔不是問這個同樣的問題,[提問前40分鐘*這個*問題(http://stackoverflow.com/questions/5600646/adjust-the-height-的最列表中,下拉框)? – 2011-04-08 21:35:43

+1

至少這一個措詞更好,我想。 – 2011-04-08 21:49:06

+0

好的,我很抱歉。我下次不會那樣做。 – tian 2011-04-08 21:54:30

回答

1

如果您使用HTML,則無法真正控制下拉框的大小。有一些方法可以使用div和滾動條來僞造它,但這是不同的

這並不容易,並且需要幾個嵌套的CSS樣式和一些Javascript,但HTML在下面。它基本上像SharePoint風格的下拉框一樣運作,有一些超過效果,點擊打開滾動選項。

enter image description here

<table cellspacing="0" cellpadding="0" class="spsItems"> 
    <tbody> 
     <tr contextmenuid="options-aaa" class="people_display"> 
      <td class="spsContext">Current Option</td> 
     </tr> 
     <tr contextmenuid="options-bbb" class="people_display"> 
      <td class="spsContext">Current Option</td> 
     </tr> 
     <tr contextmenuid="options-bbb" class="people_display"> 
      <td class="spsContext">Current Option</td> 
     </tr>        
    </tbody> 
</table> 

<div id="options-aaa" class="spsContextMenu" > 
    <ul> 
     <li>Option Value</li> 
     <li>Option Value</li> 
      ..... 
     <li>Option Value</li> 
     <li>Option Value</li>  
    </ul> 
</div> 
+0

我曾試過,但不起作用。 – tian 2011-04-08 21:44:38

+0

發佈您的HTML和CSS,讓我們看看發生了什麼 – 2011-04-08 21:45:24

+0

好的。看到我更新的帖子 – tian 2011-04-08 21:47:59