How to Set Height for the Drop Down of Select box

后端 未结 7 1350
-上瘾入骨i
-上瘾入骨i 2020-12-01 17:59

my selectbox is showing scroll when number of options are more than 20 i just want to show scrol in when options are more than 10

 
                        
    
提交评论

  • 2020-12-01 18:29

    Try adding this to the <select> element:

    onfocus='this.size=10;' 
    onblur='this.size=1;' 
    onchange='this.size=1; this.blur();
    

    like:

       <select onfocus='this.size=10;' onblur='this.size=1;' 
            onchange='this.size=1; this.blur();'>
    

    SAMPLE DEMO

    0 讨论(0)
  • 2020-12-01 18:29

    use below css

    select{ padding:5px;}
    
    0 讨论(0)
  • 2020-12-01 18:44

    check this .i have implemented scroll to your select box. http://plnkr.co/edit/XiKZ4X2DGYTJDjJX2xvw?p=preview

    0 讨论(0)
  • 2020-12-01 18:46

    In Case of setting size (height/width) and fitting the selection list in the pop up then try the following in VFPage- Salesforce:

    <apex:selectList onclick="this.size=5;" required="true" id="form-element-05" value="{!scheduleBatchWrapper.hour}" size="1" styleClass="slds-select selectObj  slds-m-left_medium slds-m-top_medium schTime" style="max-width:50%; margin-bottom:5% margin-top:5%,max-height:20%" >
                                                                                <apex:selectOptions value="{!scheduleBatchWrapper.hoursList}"></apex:selectOptions>
                                                                            </apex:selectList>
    

    // here onclick="this.size=5;" will set the size to 5 when you click on the selectList. //it works fine for Chrome,Firefox,Edge.

    Thanks

    0 讨论(0)
  • 2020-12-01 18:47

    Why dont you add CSS style to specify the width and height of the select. Check the article--> http://cssdeck.com/labs/styling-select-box-with-css3

    0 讨论(0)
  • 提交回复
    热议问题