select2 - Setting different width to input and dropdown

后端 未结 8 1905
广开言路
广开言路 2021-02-01 00:47

I am using Select2 3.3.2

I have very very long options in the select. Example:


                        
    
提交评论

  • 2021-02-01 01:35

    Here's how to make select2 wider only when its open:

    If you want it to expand towards the right side, add this css:

      .select2-container.select2-dropdown-open {
        width: 170%;
      }
    

    if you want it to expand left, add this {

      .select2-container.select2-dropdown-open {
        width: 170%;
        margin-left: -70%;
      }
    
    0 讨论(0)
  • 提交回复
    热议问题