Make text in select element wrap when too long?

前端 未结 3 1950
南旧
南旧 2020-12-15 02:13

I have a select list where the text within the options is too long as is getting cropped. Is it possible to make the text wrap instead so that all of it is visible?

3条回答
  •  执笔经年
    2020-12-15 02:42

    It seems there is no way to accomplish this in Firefox without reinventing the wheel.

    The solution I have come up with achieves this for other browsers, and uses an ellipsis in Firefox:

    select {
        max-width: 100%;
        white-space: normal;
        /* For Firefox: */
        text-overflow: ellipsis;
    }
    

提交回复
热议问题