zoukankan      html  css  js  c++  java
  • td长度固定,内容过长,用固定长度

    table { 
        table-layout: fixed; 
    }
    table 长度要明确
    
    table tr td {
           text-overflow: ellipsis; /* for IE */  
        -moz-text-overflow: ellipsis; /* for Firefox,mozilla */  
        overflow: hidden;  
        white-space: nowrap;  
        text-align: left   
    } 
    一般的文字截断(适用于内联与块):
    
    
    .text-overflow{
    display:block;                     /*内联对象需加*/
    31em;
    word-break:keep-all;           /* 不换行 */
    white-space:nowrap;          /* 不换行 */
    overflow:hidden;               /* 内容超出宽度时隐藏超出部分的内容 */
    text-overflow:ellipsis;         /* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用。*/
    }
    
    
    对于表格,定义有点不一样:
    
    
    table{
    30em;
    table-layout:fixed;                 /* 只有定义了表格的布局算法为fixed,下面td的定义才能起作用。 */
    }
    td{
    100%;
    word-break:keep-all;             /* 不换行 */
    white-space:nowrap;            /* 不换行 */
    overflow:hidden;                  /* 内容超出宽度时隐藏超出部分的内容 */
    text-overflow:ellipsis;            /* 当对象内文本溢出时显示省略标记(...) ;需与overflow:hidden;一起使用。*/
    }
  • 相关阅读:
    本地存储 localStorage
    正则对象
    面向对象
    事件
    日期对象
    网易适配与淘宝适配
    自动把网页px单位转换成rem
    湖南省web应用软件(中慧杯)
    百度图片审核功能
    百度ai语音识别
  • 原文地址:https://www.cnblogs.com/hugang2017/p/7736360.html
Copyright © 2011-2022 走看看