How to set the excess of a tag to ellipsis by css3
Editor to share with you how to set the a tag excess as an ellipsis in css3. I hope you will get something after reading this article. Let's discuss it together.
Methods: 1, use "overflow:hidden;" style to set a tag text beyond hiding; 2, use "display: block;" to set a tag as a block-level element; 3, use "text-overflow:ellipsis;" to set the style of the excess part of a tag to ellipsis.
The operating environment of this tutorial: windows10 system, CSS3&&HTML5 version, Dell G3 computer.
How to set the excess of a tag to ellipsis by css3
The text-overflow attribute specifies how it should be displayed when the text overflows the element that contains it. It can be set that after the overflow, the text is cut and the ellipsis (.) Or display custom strings (not supported by all browsers).
Text-overflow: clip | ellipsis | string | initial | inherit
Clip cuts the text.
Ellipsis displays ellipsis symbols. To represent the trimmed text.
Examples are as follows:
A label text with a fixed length and style can display the ellipsis.
Css:
.cont {width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; float: left;}
Html:
This is a document with a long name to test for out-of-function.
The display effect is as shown in the figure:
After reading this article, I believe you have a certain understanding of "how to set the a tag for ellipsis in css3". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!