How to use css to realize text overflow and display ellipsis
This article is to share with you how to use css to achieve text overflow to display ellipses. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The code is as follows:
HTML5 tag
P {
/ * *
White-space:nowrap; means that the text will not wrap and continue on the same line until you encounter
Until the label
Overflow:hidden; does not display content that exceeds the size of the object, just hides the excess
Text-overflow:ellipsis; is displayed when the text object overflows. Of course, you can also set the property to clip to not display dots.
-o-text-overflow: for compatibility with opera browsers
, /
Width:200px
Overflow:hidden
Text-overflow:ellipsis
-o-text-overflow:ellipsis
White-space:nowrap
}
Div {
/ * text beyond height is not displayed * /
Overflow:hidden
Display:block
Height:60px
Width:100px
}
This is more friendly to search engines because the title is not actually truncated, but is limited to the width and is not displayed.
This is more friendly to search engines because the title is not actually truncated, but is limited to the width and is not displayed.
Thank you for reading! On "how to use css to achieve text overflow display ellipsis" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!