我正在使用 asp.net。我正在尝试修复 div 的高度。我将所有数据隐藏在溢出中。这是我的代码示例:
<div id="Content" style="height: 90px !important; overflow: hidden; text-decoration: none;
text-overflow: ellipsis; display: block; white-space: nowrap;">
abcd<br />
efgh<br />
ijkl<br />
mnop<br />
qrst<br />
uvwx<br />
</div>
我想显示 ijkl 之前的内容,我想在溢出部分显示 More...
这是一个演示:
abcd
efgh
ijkl
more..
但我无法获得此输出。我想给内联CSS。请帮助我。
怀念
最佳答案
你可以在 div 下面添加标签,像这样:
<div id="Content" style="height: 90px !important; overflow: hidden; text-decoration: none">
abcd<br />
efgh<br />
ijkl<br />
mnop<br />
qrst<br />
uvwx
</div>
<label style="display: none">more..</label>
当文本像这样溢出时,使用 jquery 来玩弄它的可见性:
$(function(){
if($('#Content')[0].scrollHeight > $('#Content').height())
$('#overflowLabel').show();
});
关于asp.net - div 溢出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18826691/