【问题标题】:Set width of select options设置选择选项的宽度
【发布时间】:2014-01-23 14:23:19
【问题描述】:

我对选择标签的选项宽度有疑问。我想 长文本不会导致选项超出选择的边界 标签。可以在此小提琴中查看此行为: http://jsfiddle.net/zono/KTu7x/5/ 这只是一个简单的选择标签:

<select id="myselect">
<option>short string</option>
<option>long string long string long string</option>    
<option>short string</option>
<option>short string</option>
<option>short string</option>
</select>

我不希望选项超出黑色边框(附图)。

我将不胜感激。

最好的问候。

【问题讨论】:

标签: css html


【解决方案1】:
$("#testselectset").selectBoxIt({
            theme: "default",
            defaultText: "Make a selection...",
            autoWidth: false
        });

您将无法保留选择框的大小,但如果您使用 Selectboxit 插件,您就可以做到这一点。它使选项标签在文本到达某个点后换行。以here 为例。我希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 2016-08-09
    • 1970-01-01
    • 2019-09-30
    • 2019-05-13
    • 2023-03-23
    • 2018-08-20
    • 2014-02-11
    • 2013-04-11
    相关资源
    最近更新 更多