2014-01-23 149 views
3

我有选择的标签选项宽度的问题。我想 长文本不会导致选项超出选择 标记的边界。这种行为可以在这个小提琴查看: 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> 

我不想选择,黑色的边框(附图片)以外去。 enter image description here

我希望得到任何帮助。

此致敬礼。

+0

你想干什么?省略号?例如:“long string long ...” – RichieAHB

+0

要在第二行显示的文本或者不可见的文本。文字中断:全部打破;溢出:隐藏;选项选择器根本没有帮助。 –

+0

嗯,用纯CSS,我认为,你将无法改变这种行为。你可以做的是重建与UL和李(http://stackoverflow.com/questions/8430279/how-to-style-the-option-with-only-css#8431078) – bouscher

回答

1
$("#testselectset").selectBoxIt({ 
      theme: "default", 
      defaultText: "Make a selection...", 
      autoWidth: false 
     }); 

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