Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set the excess of a tag to ellipsis by css3

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report