html溢出时如何在文本上添加三个点? [英] how to add three dots to text when overflow in html?
本文介绍了html溢出时如何在文本上添加三个点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在这样的文本中显示三个点(...)?
How can I show three dots(...) in a text like this?
推荐答案
添加所有这些. 单行制作.
Add all these. To make in single line.
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
width:100px; // some width
要按您实际要求的多行方式进行.
To do in multi line which actually you asked.
#content{
overflow: hidden;
width:100px;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
工作小提琴: https://jsfiddle.net/mishrarajesh/676jc7sa/
请注意,此多行代码目前仅在Web-kit浏览器中受支持.
Please note that this multiline code is supported only in web-kit browsers for now.
这篇关于html溢出时如何在文本上添加三个点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文