codeHysteria127
codeHysteria127

Reputation: 97

What could be reason of select2 element shrinks the width?

What could be a reason of this ? One element of select2 is displaying normally and the other one not ? I tried to change the structure of the html and also there are not any other styles that might override it. It seems the plugin is giving the broken select "as on the picture" dynamic width. Strange but thanks for any help.

enter image description here

enter image description here

Upvotes: 1

Views: 362

Answers (1)

Samuel Krempasky
Samuel Krempasky

Reputation: 433

Just add width options $("#company-filter").select2({ dropdownAutoWidth : true, width : '<value>'}); instead of $("#company-filter").select2(); and add some padding-right for dropdown button, so

.select2-container .select2-selection--single .select2-selection__rendered {
padding-left: 20px;
padding-right: 50px;
}

Upvotes: 2

Related Questions