开发者

Is it possible for select lists in HTML to have a horizontal scrollbar?

开发者 https://www.devze.com 2022-12-27 17:04 出处:网络
If you have an HTML <select multiple> of a certain width and height (set in CSS), if there are more values then you can possibly fit in that height, then the browser adds a vertical scroll bar.

If you have an HTML <select multiple> of a certain width and height (set in CSS), if there are more values then you can possibly fit in that height, then the browser adds a vertical scroll bar. N开发者_如何学运维ow if the text is longer than the available width, is it possible to instruct the browser to add a horizontal scrollbar?


No; you'll need to emulate the list yourself.


Not that I'm aware of.

If you'd like, put the list in a div of your desired width, and set the following style on the div:

overflow-x: scroll

This will cause the div to add a horizontal scroll bar when the select is too wide

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号