Broken overflow on fixed width.
See original GitHub issueIf select2 input has a limited with, the value overflow is broken as you can see on the following screenshot:
I use the following code to instanciate select2:
select.select2({
width: '100%',
placeholder: ' ',
dropdownAutoWidth: true,
minimumResultsForSearch: 10,
allowClear: allowClearEnabled
});
Don’t know how to fix this issue, any idea?
Thanks.
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
DIV with fixed width. Break children to right after DIV height ...
I have a column (DIV) with a width of 300px and a height of 100vh that contains arbitrary children (other DIVs with different...
Read more >Overflow Issues In CSS
One of the most common causes of overflow is fixed-width elements. Generally speaking, don't fix the width of any element that should work...
Read more >Overflowing content - Learn web development | MDN
This box has a height and a width. This means that if there is too much content to be displayed within the assigned...
Read more >How To Fix Text-Overflow Ellipsis Not Working
You have a width set, but because the element's display property is also set to inline (often the default for spans,) overflow is...
Read more >overflow
Unless a height is set, text will just push an element taller as well. Overflow comes into play more commonly when explicit widths...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m using
4.0.0b3
.Whenever I selected a very long text, the overflow was not hidden like you describe. I had to add the following css to hide it:
disclaimer: I’m a select2 neophyte.
I have same trouble with you, then I found a way to fix it.
in view, I wrote this,
<select class="select2" data-width="100%" multiple id="xref" name="xref[]"></select>
then in js, I wrote this
$("#xref").select2({ containerCssClass: 'wrap' });
and add css in select2 css like this:
.wrap.select2-selection--multiple { height: 100% }
.select2-container .wrap.select2-selection--multiple .select2-selection__rendered li { word-wrap: break-word; text-overflow: inherit; white-space: normal !important }
hope this will help you ^^