-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple select height issue #4756
Comments
If you want to disable the "extra" height (the 7px) select2 adds when using multi-select option I think this css might do the trick and it won't mess up the style of your dropdown list. Took me a while to figure it out. .select2-container--open .select2-selection__rendered{ .select2-container .select2-search--inline{ |
The only way I found is to set something like:
But when forcing height when multiple selections are made they get out of the box (the input do not expand anymore). |
@korent Hi! Your code worked for me but because of display: none, the placeholder text is not showing. I tried to add it to data-placeholder with jQuery, but initiating select2 seems to ignore prior javascript set on the select input... any ideas to show the placeholder text? |
Can reproduce the issue with this JSFiddle. Do you know if you plan on fixing this issue? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
up |
FOUND CSS SOLUTION: Works in Chrome, Firefox, Safari (latest versions on windows) |
Codepwned2 has the best answer. It is working like a charm now. |
I think the Codepwned2 answer does not apply any longer. |
So... I've come across this today and the extra 7px are (in my opinion) there to compensate for
... of course adjust the classes to adapt to your specific case (like |
I have fixed it with this body .select2-container .select2-selection--multiple .select2-selection__rendered { body .select2-container--default .select2-selection--multiple .select2-selection__rendered li { body .select2-container--default .select2-search--inline .select2-search__field { .select2-container { .select2-container--default.select2-container--focus .select2-selection--multiple, .select2-container--default .select2-selection--multiple { |
When using a multi select, I can't properly change the height.
.select2-container--default .select2-selection--multiple {
.select2-container .select2-selection--multiple {
min-height: ;
}
doesn't go below its default 32px; when changed to anything lower ie 26px;
changing all margin-top to 0px; and removing all padding from the stylesheet doesn't help. and I use a reset stylesheet.
Not being able to change the height I have to align the selected grey boxes and the input height to vertical align with margin-top, but this always results in extra "padding" on the bottom, adding anything bigger than margin-top: 5px; and the select box gets bigger, meaning the padding still stays.
tldr; min-height does nothing, and centering the crap inside still results in extra "padding-bottom" and the select2.css stylesheet is an unfathomable nightmare.
Would just like a 26px height multi select box, with the selected options being 22 - 24px height and vertical centered.
The text was updated successfully, but these errors were encountered: