我在Bootstrap 3水平表单中使用SelectBoxIt输入(http://gregfranko.com/jquery.selectBoxIt.js/)。我希望输入随着窗体的宽度增长和折叠,但是当将宽度设置为100%时,它们最终会折叠。
我已经创建了一个JSFiddle来显示我的问题,并想知道是否有任何善于使用CSS的人能提出解决方案或建议吗?
http://jsfiddle.net/oceanexplorer/a5AZF/
<form class="form-horizontal">
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
<div class="form-group">
<label class="col-xs-4 col-sm-4 col-md-4 col-lg-4 control-label">Option1</label>
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
<select name="foo">
<option value="1">Foo1</option>
<option value="2">Foo2</option>
<option value="3">Foo3</option>
<option value="4">Foo4</option>
<option value="5">Foo5</option>
<option value="6">Foo with a really, really long text line that we shall use in order to test the wrapping of text within an option or optgroup</option>
</select>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
<div class="form-group">
<label class="col-xs-4 col-sm-4 col-md-4 col-lg-4 control-label">Option1</label>
<div class="col-xs-8 col-sm-8 col-md-8 col-lg-8">
<select name="foo">
<option value="1">Foo1</option>
<option value="2">Foo2</option>
<option value="3">Foo3</option>
<option value="4">Foo4</option>
<option value="5">Foo5</option>
<option value="6">Foo with a really, really long text line that we shall use in order to test the wrapping of text within an option or optgroup</option>
</select>
</div>
</div>
</div>
</form>
CSS
.selectboxit-container .selectboxit-options,
.selectboxit-container .selectboxit
{
width: 100%;
}
.col-xs-8,
.col.sm-8,
.col-md-8,
.col-lg-8
{
border: 1px solid black;
}
$("select").selectBoxIt({
autoWidth: false
});
答案 0 :(得分:4)
在第一条规则中包含容器:
.selectboxit-container .selectboxit-options,
.selectboxit-container .selectboxit,
.selectboxit-container {
width: 100%;
}