如何构建< select>与多线选项? [英] How can I build a <select> with multiline options?
问题描述
我需要构建一个多行选择控件。我的意思是,所有< option>
其中文本宽度大于300px(例如)变成具有不超过所述限制的必要行。
I need to build a multiline select control. I mean, all the <option>
where text is wider than 300px (for example) become to have the necessary lines to don't exceed the mentioned limit.
这些图片代表了自己:
首先我尝试了,但不工作。
First of all I tried this, but does not work.
<html>
<head>
<style>
option{
width: 100px;
white-space: wrap;
}
</style>
</head>
<body>
<select>
<option>I'm short</option>
<option>I'm medium text</option>
<option>I'm a very very very very very very very very very long text</option>
</select>
</body>
</html>
我搜索了很多,但没有找到符合我期望的东西。
I've searched a lot but I didn't find anything that suits my expectations.
我使用bootstrap框架,我想我也许可以使用下拉控件来获得结果。我尝试设置max-width CSS属性,但它不工作...
I'm using bootstrap framework and I thought that maybe I could use dropdown control to obtain the result. I've tried setting the max-width CSS property, but it does not work too...
也许你可以给我建议或一些插件。
Maybe you can give me advice or some plugin which does that.
提前感谢。
推荐答案
https://github.com/fnagel/jquery-ui/wiki/Selectmenu
我认为这可以帮助你,从来没有使用过:)
I think this can help you, never used before :)
这篇关于如何构建< select>与多线选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!