select2-3.5.2 工作正常。但当我升级到 4.0.3 后,它突然出现在页面左侧。我正在使用 jquery-UI,希望这两个能够很好地协同工作。
float :右;对 select2-4.0.3 没有影响
<div style="position:absolute; top:0px; left:0px; width:100%" class="ui-widget infobar-wrapper">
<div name="ibar1" id="ibar1" class="ui-widget-header infobar">
<select name="themes" id="themes" style="float:right;"> <!--margin-top:-3px;-->
<option></option>
<option value="black-tie">black-tie</option>
<option value="trontastic">trontastic</option>
<option value="ui-darkness">ui-darkness</option>
<option value="ui-lightness">ui-lightness</option>
</select>
</div>
</div>
当我在 JS 中这样做时:
$("#themes").select2({dropdownAutoWidth:true,placeholder:'Change theme'});
CSS:
.infobar {
height:27px;
font-weight:bold;
overflow:hidden;
border:0px;
}
最佳答案
似乎,但也似乎 float
应该移动到另一个项目。
CSS
.infobar {
height: 27px;
font-weight: bold;
overflow: hidden;
border: 0px;
}
.infobar .select2-container {
float: right;
}
关于javascript - select2 对齐不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38679425/