CSS control text beyond the specified width with ellipsis instead of CSS control text does not wrap

Source: Internet
Author: User

CSS control text beyond the specified width is replaced with ellipses, CSS control text does not wrap.

Generic truncation of text (for inline and block):

. text-overflow {
display:block;/* inline objects need to be added */
Width:31em;
word-break:keep-all;/* does not change the line */
white-space:nowrap;/* does not change the line */
overflow:hidden;/* content is hidden when content is out of width */
text-overflow:ellipsis;/* display 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

table{
Width:30em;
table-layout:fixed;/* only the table-defined layout algorithm is fixed, the following TD definition will work. */
}
td{
width:100%;
word-break:keep-all;/* does not change the line */
white-space:nowrap;/* does not change the line */
overflow:hidden;/* content is hidden when content is out of width */
text-overflow:ellipsis;/* display ellipsis (...) when text inside an object overflows; use with Overflow:hidden; */
}


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.

The above problems can be solved: how to control text wrapping with CSS? How do I control text without wrapping using CSS? How do I use CSS to control how the text goes out of range and displays ellipses? How do I use CSS to control when text is out of range? Thank you for your visit ~ ~ ~

CSS control text beyond the specified width with ellipsis instead of CSS control text does not wrap

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.