CSS Intercept string display ellipsis

Source: Internet
Author: User

Sometimes, in order to avoid the page of a div content too much, and cause page distortion, we usually define Overflow:hidden in CSS, so that will not display text, but it seems that the user experience is not very good, in order to get the best user experience, we hide the text at the same time, You can display ellipses behind text, and there are ready-made methods in CSS that you can use, such as the following CSS definition:

1/*CSS code is as follows: * *

2show{

3overflow:hidden;

4white-space:nowrap;

5text-overflow:ellipsis;

6/* adds a width definition to the div that displays the text, and automatically adds an ellipsis when the width is exceeded * * *

7width:30px;

8}

In the above code, Text-overflow:ellipsis is to show the ellipsis, is it good?

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.