css td 溢出改为省略号

    <style>
        .table{
            table-layout: fixed;
            width:100%;
        }
        .td{
            width:100px;  
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        word-wrap: normal;
} table td { border:1px solid red; } </style>

第二种方式是用js直接截取字符串,在拼接三个点...;这样页面样式看上去也像是超出变成...

截取字符串的方法有很多钟,这里只举例一种:str=str.substring(0,i); // 取字符串的前i个字符;

想要了解更多截取字符串方法,推荐一篇文章 https://www.cnblogs.com/cuixiaohua/p/7373171.html

 备注: .table是整个表格的样式, .td是需要改变td长度溢出变省略号的样式。

相关文章:

  • 2021-06-01
  • 2022-01-07
  • 2022-01-07
  • 2022-01-07
  • 2022-01-07
  • 2021-12-22
  • 2021-10-24
  • 2021-11-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-27
  • 2022-12-23
相关资源
相似解决方案