select2高度和宽度显示问题

一、高度问题

text 的form-control属性:

line-height: 34px;

select2 的form-control属性:

line-height: 28px;

select2和text在同一行显示时,高度会不一致,影响显示效果。

需添加

<style type="text/css">
        .select2-container .select2-selection--single {
            height: 34px;
            line-height: 34px;
        }
        .select2-container--default .select2-selection--single .select2-selection__rendered
        {
            line-height: 34px;
        }
    </style>

二、宽度问题

select2在使用form-control,有时select2的宽度并没有填充宽度,需使用jq添加$(‘#id’).css("width","100%");

猜你喜欢

转载自www.cnblogs.com/dddkk/p/9154197.html