CSS controls text beyond the specified width display ellipses and text without wrapping

Source: Internet
Author: User

generic truncation of text (for inline and block):
. Text-overflow{Display:Block;/*inline objects need to be added*/width:31em;/*how to ask Hovertree.com*/Word-break:Keep-all;/*No Line break*/White-space:nowrap;/*No Line break*/Overflow:Hidden;/*Hide content beyond width when content is out of bounds*/Text-overflow:ellipsis;/*show ellipsis (...) when text inside an object overflows; use with Overflow:hidden; */}

For the definition of a table literal overflow:

Show ellipsis for table out of range

1 Table{2 width:30em;3 Table-layout:fixed;/*only if the layout algorithm that defines the table is fixed, the following TD definition will work. */4}5 /*6 How to ask7 hovertree.com8 */9 TD{Ten width:100%; One Word-break:Keep-all;/*No Line break*/ A White-space:nowrap;/*No Line break*/ - Overflow:Hidden;/*Hide content beyond width when content is out of bounds*/ - Text-overflow:ellipsis;/*show ellipsis (...) when text inside an object overflows; use with Overflow:hidden; */ the}

It is important to note that this CSS style only works on a single line of text, and if you want to use it on multiple lines, only the first line will work. This writing only IE will have "...",

Other browser text is hidden when it exceeds the specified width.

Special effects: http://www.cnblogs.com/roucheng/p/texiao.html

CSS controls text beyond the specified width display ellipses and text without wrapping

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.