【发布时间】:2017-03-20 06:55:02
【问题描述】:
我正在尝试增加 select2 下拉容器的高度,同时将其他容器保持在默认高度。我的容器宽度是固定的,当我选择第二个选项时,我不希望在容器中强制插入一个空行(如果我使用“height-min”,就会发生这种情况)。你会see all this in the jsfiddle
任何人对我如何控制第一个容器同时不理会第二个和第三个容器有任何想法吗?已经有几篇关于此的帖子,但似乎没有任何效果。
https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js
https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css
<select id="dropList1" style="width:125px;" multiple="multiple">
<option value="Sun">Sun</option>
<option value="Moon">Moon</option>
<option value="Stars">Stars</option>
</select>
<br>
<br>
<br>
<select id="dropList2" style="width:125px" multiple="multiple">
<option value="Earth">Earth</option>
<option value="Wind">Wind</option>
</select>
<br>
<br>
<br>
<select id="dropList3" style="width:125px" multiple="multiple">
<option value="Fire">Fire</option>
<option value="Water">Water</option>
</select>
$("#dropList1").select2({ placeholder: "Select type",});
$("#dropList2").select2({ placeholder: "Select type",});
$("#dropList3").select2({ placeholder: "Select type",});
body {
padding: 30px;
}
.select2-container .select2-selection--multiple {
font-family: 'Arial', Verdana;
font-size: 12px;
box-sizing: border-box;
display: block;
height: 27px;
}
【问题讨论】:
-
我试过这个,使用其他帖子的建议,但它根本没有效果。