似乎选择一个包含很长文本的选项会使select2容器增长。
示例:https://jsfiddle.net/vxbbph6h/1/
重现问题:
1)将浏览器调整为小宽度
2)选择下拉列表中的最后一个选项
HTML:
<body>
<div role="main" class="col-sm-9 ef-middle-column">
<table width="100%">
<tbody>
<tr>
<td>
<label for="myDropdown">dropdown</label>
</td>
<td>
<select
id="myDropdown"
style="max-width:200px"
name="myDropdown"
>
<option value="One">One</option>
<option value="Two">Two</option>
<option value="Three-Thirty">Three-Thirty (£69.00)</option>
<option value="Twenty-Two">Twenty-Two</option>
<option value="One hundred and lots more numbers after this to see what happens with long text">One hundred and
lots more numbers after this to see what happens with long text</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
</div>
JS:
$('#myDropdown').select2();
CSS:
[class*="col-"] .select2-container {
width:89%!important;
max-width: 481px;
}