The Css,bootstrap table controls the use of ellipses when the TD content is too long, and an ellipsis when the bootstrap is not used

Source: Internet
Author: User

First, you need to set the table-layout:fixed in the table;

<table style="table-layout:fixed"></table>

Then set the width of each column in the table header th

<table style="table-layout:fixed"><th width="10%" >title01</th><th width="20%">Title02</th><!--  other th- -></table>

Then add a style to the TD that is represented by an ellipsis when the length is greater than a certain number

<table style="table-layout:fixed"><th width="10%">title01</th><th width="20%">Title02</th><!--other th--><c:foreachItems =""  var=""Varstatus =""&GT;&LT;TD&GT;&LT;TITLE01&LT;/TD&GT;&LT;TD style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;"><title02</td><!--other TD--></c:foreach></table>

Bootstrap need to be set to th when table size is set, otherwise it may not take effect, the above is available in bootstrap

When not using bootstrap can use the following style, online search, more useful

<! DOCTYPE HTML Public"-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD"> "Text/css">. mytable {Table-layout:fixed; Width:98%border:0px;   margin:0px; }. mytable tr td {Text-overflow:ellipsis;/*For IE*/-moz-text-overflow:ellipsis;/*For Firefox,mozilla*/Overflow:hidden; White-Space:nowrap;       BORDER:1PX solid; Text-Align:left}</style> "500px" class="mytable"> <tr> <td width="20%"> Don't Kangqiao </td> <td width="80%">softly I walked, as I softly came, I waved a wave of sleeves, without taking a piece of cloud</td> </tr> </table> </body> 

The Css,bootstrap table controls the use of ellipses when the TD content is too long, and an ellipsis when the bootstrap is not used

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.