Limit Initial width of select list

前端 未结 6 1225
春和景丽
春和景丽 2021-01-12 20:17

I have a select list, where some clients have entered insanely long options for them, which breaks the design. I\'m wondering if there is a way to set a fixed width on the s

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-12 20:54

    Add to the CSS something like this:

    select {
        border: 1px solid #838383;
        border-style: outset;
        font-weight: bold;
        color: #3F3F3F;
        max-width: 150px !important;
        overflow: hidden;
    }
    
    option {
        max-width: 120px !important;
        overflow: hidden;
    }
    

    This works for me. Note there are no dots in front of the anchors.

提交回复
热议问题