通过CSS自动截取字符串长度

 
Table Tr TD的自动换行
 1         <style type="text/css">
 2             table {
 3                 width: 30em;
 4                 table-layout: fixed; /* 只有定义了表格的布局算法为fixed,下面td的定义才能起作用。 */
 5             }
 6 
 7                 table td {
 8                     width: 100%;
 9                     word-break: keep-all; /* 不换行 */
10                     white-space: nowrap; /* 不换行 */
11                     overflow: hidden; /* 内容超出宽度时隐藏超出部分的内容 */
12                     text-overflow: ellipsis; /* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用。*/
13                 }
14         </style>
View Code

 其他的换行参照类似

原文地址:https://www.cnblogs.com/mailaidedt/p/6525481.html