Html + CSS: Hide the text beyond the length and display the ellipsis,

Source: Internet
Author: User

Html + CSS: Hide the text beyond the length and display the ellipsis,

Table:

Table {
Table-layout: fixed;
}
}
T
Td {
 
White-space: nowrap;
Overflow: hidden;
Text-overflow: ellipsis;
}
}

This method is used to solve the problem of the appearance of too many table cells, mainly involving four CSS styles:
1. table-layout: fixed because the default value of table-layout is auto, that is, the width and height of a table depend on the quantity of its content. If the volume of the content cannot be estimated, therefore, the final form of the table cannot be guaranteed, and fixed is enough. (Note: This style is critical)
2. white-space: nowrap is used to ensure that no text is automatically wrapped regardless of the number of text content in the cell (TD). In this case, the excess content will break through the cell horizontally.
3. overflow: Hide the part beyond the cell.
4. text-overflow: ellipsis replaces the hidden part with a ellipsis.


Address: http://www.itmmd.com/201410/92.html
This article is organized and published by android Developers. The source must be indicated ..

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.