![](/img/trans.png)
[英]nice-select plugin is selecting only the first element in html table
[英]JQuery Nice-Select's selected text overflowing out of the dropdown when width is fixed or 100%
$('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>
当您 select 第二个选项value="1"
时,所选文本溢出下拉菜单。 我们如何解决这个问题? 我尝试了所有解决方案,例如text-overflow
、 word-wrap
并尝试修复父容器的宽度,但似乎没有任何效果。
制作 span 块,并隐藏溢出:
span.current {
display: block;
overflow: hidden;
text-overflow: ellipsis;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.