When the css exceeds the limit, the ellipsis is displayed. If the css exceeds the limit, the ellipsis is displayed.

Source: Internet
Author: User

When the css exceeds the limit, the ellipsis is displayed. If the css exceeds the limit, the ellipsis is displayed.

Code: overflow: hidden; white-space: nowrap; text-overflow: ellipsis;

Key code: text-overflow: ellipsis;

Explanation: Simply put, I want to limit the text to one line (white-space: nowrap;). It must be a restricted line (width ), in addition, the overflow part should be hidden (overflow: hidden;), and then the ellipsis (text-overflow: ellipsis) will appear ).

Text-ellipsis is a special style. The interpretation is as follows: the text-overflow attribute is only an annotation, and whether the omitted mark is displayed when the text overflows. Does not have other style attribute definitions. To achieve the effect of skipping numbers during overflow, you must also define: to force the text to be displayed (white-space: nowrap) in a row and to hide the overflow content (overflow: hidden ), only in this way can the overflow text display effect be achieved.

Code:

<! DOCTYPE html>  

Appendix: white-space: nowrap; http://www.w3cschool.cn/pr_text_white-space.html

Text-overflow: ellipsis; http://www.w3chtml.com/css3/properties/text/text-overflow.html


Css enables fixed box width and automatic height. The maximum height is exceeded and the ellipsis is hidden.

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.
You don't have to wrap the line. What is the purpose of setting the height...

This method is only applicable to the effect of ellipsis when a single line of text overflows.
Multi-Line Text overflow with JS

How does dreamweaver display excessive texts with ellipsis?

<! DOCTYPE html>
 

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.