我在使用SelectBoxIt.js创建一个100%宽度的选择框时遇到了一些问题
即使将CSS宽度设置为100%,选中框也不会填充容器元素的100%。
CSS:
.test1, .test2, .test2 .selectboxit, .test2 .selectboxit-options {
width: 100%;
}HTML:
<select name="test2" class="test2">
<option value="SelectBoxIt is:">SelectBoxIt is:</option>
<option value="a jQuery Plugin">a jQuery Plugin</option>
<option value="a Select Box Replacement">a Select Box Replacement</option>
<option value="a Stateful UI Widget">a Stateful UI Widget</option>
</select>发布于 2013-08-16 08:53:21
格雷格·弗兰科帮我解决了这个问题
您可以在JSBin中看到解决方案。http://jsbin.com/udapic/1/edit
基本上,您需要像这样禁用autoWidth:
$(".test2").selectBoxIt({ autoWidth: false, copyClasses: "container" });
然后将CSS中的宽度设置为100%:
.test1, .test2, .test2 .selectboxit, .test2 .selectboxit-options { width: 100%; }
发布于 2014-04-27 10:42:55
js
$(".mySelect").selectBoxIt({ autoWidth: false });然后是css
.selectboxit-container {
width: 100%;
}
.selectboxit-container .selectboxit {
width: 100%;
}https://stackoverflow.com/questions/18269428
复制相似问题