`
webcelement
  • 浏览: 37638 次
  • 性别: Icon_minigender_1
  • 来自: 天津
社区版块
存档分类
最新评论

css行内文本超出指定宽度溢出的处理

    博客分类:
  • WEB
 
阅读更多

一般文字截断:

 

.text-overflow{

    display:block;/*内联对象需加*/

    width:3.1em;

    word-break:keep-all;/*不换行*/

    white-space:nowrap;/*不换行*/

    overflow:hidden;

    text-overflow:ellipsis;/*和下面的overflow一起使用*/

    overflow:hidden;/*和上面的text-overflow一起使用*/

}

 

表格文字溢出:

 

table{

    table-layout:fixed;/*只有定义了表格的布局算法为fixed,td的定义才能起作用*/

}

td{

    width:100%;

    word-break:keep-all;

    white-space:nowrap;

    overflow:hidden;/*内容超出宽度隐藏部分*/

    text-overflow:ellipsis;

    overflow:hidden;

}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics