css 样式文字溢出显示省略号

在table中使用溢出样式,table样式要设置为”table-layout: fixed“,即<table >,溢出样式才有效果

        table tbody tr td
        {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

注释:

white-space:nowrap;表示文本不会换行,在同一行继续,知道遇到<br>标签为止;

overflow:hidden;不显示超过对象尺寸的内容,就是把超出的部分隐藏了;

text-overflow:ellipsis;当文本对象溢出是显示...,当然也可是设置属性为clip不显示点点点;

程序员的基础教程:菜鸟程序员