Text that exceeds the specified length is expressed by a ellipsis

Source: Internet
Author: User

A news title in a news list that is frequently encountered during development is too long. In this case, you can add a set of CSS rules to it to hide the characters that exceed the box and display the ellipsis at the end.

Style:

< ="/">. {:;:;:;:;:;:;}</>
 
Explanation:
White-spaceHow to process the blank space in an element in attribute settings
White-space: nowrap; indicates that the text will not wrap, and the text will continue on the same line until the <br> label is encountered.
Overflow: hidden;Hide the excess part.
Text-overflowAttribute specifies what happens when a text overflow contains elements.
Clip Trim text
Ellipsis [ɪ ˈ l ɪ ps ɪ s] Show omitted characters to represent the trimmed text
String Use the given string to represent the trimmed text
 
It is better to show the effect of the text including the hidden part by adding the mouse over the text. The Code is as follows:
.:{:;}

Shows the effect:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.