CSS extra text hidden

Source: Internet
Author: User

Sometimes the width of the container is fixed, but to display a bit more text, you need to hide the extra text, and in order to indicate that there are no words displayed, with an ellipsis.

Similar to this:

Use the following CSS style to achieve:

{    overflow: hidden;     text-overflow: ellipsis;}

Three attributes can be used together to achieve the above effect.

Overflow, the default value is visible, if you do not set the hidden, it will display all the content, to find out the scope of the container.

Text-overflow: There are three values, clip (trim text), ellipsis (using ellipses instead of trimmed text), and string (instead of trimmed text using the specified string).

Using the above style is supported in addition to IE6.

This is true in the IETester IE6:

Not only did the text not be hidden, but also the width was big (I've set the width to 300px).

Online some say add white-space:nowrap; But it's useless.

Now think of the method is to use JS, set the length of the text and then intercept, redundant use of ellipsis instead.

CSS extra text hidden

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.