目标:
更改使用bootstrap v2的选择下拉列表的宽度。
问题:
我不知道如何改变它相对于bootstrap的宽度。
信息:
请记住,我在同一页面中有三个下拉列表,其中一个是我要更改宽度的。
http://jsbin.com/roriyododa/edit?html,css,output
谢谢!
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/2.3.2/js/bootstrap.min.js"></script>
<select style="display: none;" class="selectpicker" id="fromContent" name="From">
<option value="122344">122344</option>
<option value="46731233320">46731233320</option>
<option value="abbb">abbb</option>
<option value="asd">asd</option>
<option value="d">d</option>
<option value="test">test</option>
<option value="testtest">testtest</option>
<option value="11">11</option>
<option value="24">24</option>
<option value="ddd">ddd</option>
<option value="gd">gd</option>
<option value="hn2">hn2</option>
<option value="jippo">jippo</option>
<option value="sdf">sdf</option>
<option value="sdfsdf">sdfsdf</option>
</select>
<div class="btn-group bootstrap-select">
<button title="122344" data-id="fromContent" type="button" class="btn dropdown-toggle form-control selectpicker btn-default" data-toggle="dropdown"><span class="filter-option pull-left">122344</span> <span class="caret"></span>
</button>
<div class="dropdown-menu open">
<ul class="dropdown-menu inner selectpicker" role="menu">
<li class="selected" data-original-index="0"><a tabindex="0" class="" data-normalized-text="<span class="text">122344</span>"><span class="text">122344</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="1"><a tabindex="0" class="" data-normalized-text="<span class="text">46731233320</span>"><span class="text">46731233320</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="2"><a tabindex="0" class="" data-normalized-text="<span class="text">abbb</span>"><span class="text">abbb</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="3"><a tabindex="0" class="" data-normalized-text="<span class="text">asd</span>"><span class="text">asd</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="4"><a tabindex="0" class="" data-normalized-text="<span class="text">Feedex</span>"><span class="text">Feedex</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="5"><a tabindex="0" class="" data-normalized-text="<span class="text">test</span>"><span class="text">test</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="6"><a tabindex="0" class="" data-normalized-text="<span class="text">testtest</span>"><span class="text">testtest</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="7"><a tabindex="0" class="" data-normalized-text="<span class="text">11</span>"><span class="text">11</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="8"><a tabindex="0" class="" data-normalized-text="<span class="text">24</span>"><span class="text">24</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="9"><a tabindex="0" class="" data-normalized-text="<span class="text">ddd</span>"><span class="text">ddd</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="10"><a tabindex="0" class="" data-normalized-text="<span class="text">gd</span>"><span class="text">gd</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="11"><a tabindex="0" class="" data-normalized-text="<span class="text">hn2</span>"><span class="text">hn2</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="12"><a tabindex="0" class="" data-normalized-text="<span class="text">jippo</span>"><span class="text">jippo</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="13"><a tabindex="0" class="" data-normalized-text="<span class="text">sdf</span>"><span class="text">sdf</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
<li data-original-index="14"><a tabindex="0" class="" data-normalized-text="<span class="text">sdfsdf</span>"><span class="text">sdfsdf</span><span class="glyphicon glyphicon-ok check-mark"></span></a></li>
</ul>
</div>
</div>
&#13;
答案 0 :(得分:0)
使用此CSS:
.bootstrap-select button {width: 165px; position: relative;}
.bootstrap-select button .caret {right: 10px; position: absolute;}
预览强>
答案 1 :(得分:0)
您需要在要扩展的下拉列表中添加cin
。
假设id
为css
。
id
添加到其中
#myDD
它正在操纵引导程序中默认下拉列表宽度的#myDD { min-width: 200px; }
。
答案 2 :(得分:-1)
你可以在.open&gt;中给出宽度:所需像素。 .css文件中的.dropdown-menu类