How to automatically increase the height of select2 input box (multiple)

后端 未结 2 528
旧时难觅i
旧时难觅i 2020-12-16 19:13

I have a select2 input box for multiselet option in which, user can select as many options as he wants, if the selected options are occupying more space than available width

相关标签:
2条回答
  • 2020-12-16 19:37

    Add this CSS to select2-selection--multiple class:

    .select2-selection--multiple{
        overflow: hidden !important;
        height: auto !important;
    }
    

    Updated Fiddle, I hope it works for you, Thanks.

    0 讨论(0)
  • 2020-12-16 19:42

    Use min-height:22px instead of height:22px

    select2-container--default .select2-selection--multiple {
      background-color: #ffffff;
      border: 1px solid rgba(0, 0, 0, 0.1);
      -webkit-border-radius: 2px;
      border-radius: 2px;
      cursor: text;
      min-height: 22px;
    }
    
    0 讨论(0)
提交回复
热议问题