question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Broken overflow on fixed width.

See original GitHub issue

If select2 input has a limited with, the value overflow is broken as you can see on the following screenshot:

select2_overflow

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:closed
  • Created 9 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
xmikewcommented, Jan 29, 2015

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:

.select2-selection--single {
  overflow: hidden;
  text-overflow: ellipse;
}

disclaimer: I’m a select2 neophyte.

0reactions
flickervalecommented, May 23, 2017

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 ^^

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found