table-layout:fixed;固定了列宽度;也就会有长的内容会显示不全,那么可以用white-space:normal;来进行换行
方法1:
/*设置 tbody高度大于400px时 出现滚动条*/ table tbody { display: block; height: 400px; overflow-y: scroll; } table thead, tbody tr { display: table; width: 100%; table-layout: fixed; } /*滚动条默认宽度是16px 将thead的宽度减16px*/ table thead { width: calc( 100% - 1em) }