Stack Overflow Asked by Aishwarya Shiva on December 11, 2021
$('select').niceSelect();
span.current {
text-overflow: ellipsis;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-nice-select/1.1.0/js/jquery.nice-select.min.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-nice-select/1.1.0/css/nice-select.min.css" rel="stylesheet"/>
<select class='wide'>
<option data-display="Select">Nothing</option>
<option value="1">Some lonnnnnnnnnnnngggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg option</option>
<option value="2">Another option</option>
<option value="3" disabled>A disabled option</option>
<option value="4">Potato</option>
</select>
When you select the second option with value="1"
the selected text overflows out of the dropdown. How can we fix this? I tried all the solutions like text-overflow
, word-wrap
and tried fixing the widths of parent containers but nothing seem to work.
Make the span block, and hide the overflow:
span.current {
display: block;
overflow: hidden;
text-overflow: ellipsis;
}
Answered by CBroe on December 11, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP