When text overflows, it appears as an ellipsis

Source: Internet
Author: User

When the element is set to a fixed width, if the text inside the element is outside the width, set it to the ellipsis effect:

The Text-overflow property specifies what happens when the text overflows the containing element.

Grammar
text-overflow:clip|ellipsis| string;
value Description  
Clip Trims the text.
Ellipsis Displays the ellipsis to represent the trimmed text.
String Uses the given string to represent the trimmed text.

The White-space property sets how to handle whitespace within an element.

Possible values
value Description
Normal Default. The blank will be ignored by the browser.
Pre The blank will be reserved by the browser. It behaves like a <pre> tag in HTML.
NoWrap The text does not wrap, and the text continues on the same line until the <br> tag is encountered.
Pre-wrap Preserves the sequence of whitespace characters, but wraps them normally.
Pre-line Merges a sequence of whitespace characters, but preserves newline characters.
Inherit Specifies that the value of the White-space property should be inherited from the parent element.

Make sure that the element you set has a fixed width:

. calss{      text-overflow:ellipsis;      White-space:nowrap;      Overflow:hidden;        }

The effect is as follows:

When text overflows, it appears as an ellipsis

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.