table 自适应案例

(1)使table表格自适应 不出现滚动条 需要给table 加 table-layout: fixed; 样式 ;

(2)单独设置某列单元格的宽度 给 thead下的 th 设置;

(3)需要给 tbody中的 td 添加 标签 ;

(4)要使table表格的td溢出后显示… 分别 给th 和 td 添加 overflow:hidden; text-overflow:ellipsis; white-space:nowrap; 样式 ;

(5)不用给每个th都设置宽度,只需给需要的设置即可;

table{font-size: 14px;color: #5a5a5a; width: 100%;table-layout: fixed;}
table thead tr th{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
table thead tr th:first-child{width:10%;}
table tbody tr td>div{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
huan

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: