HTML table表格td固定继承宽度,过长换行显示,不允许自动加长

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chenbetter1996/article/details/83038748
table {
    border: #f2d69c 10px groove;
    width: 95%;
    padding: auto;
    margin-left: 2.5%;
    margin-right: 2.5%;
}

设置成这样

如果数据很长的话,会突破95%长度

添加下面的样式设置即可解决

td {
    /* 保证数据不会挤爆拉长表格宽度,到点就换行 */
    word-break: break-all;
}

猜你喜欢

转载自blog.csdn.net/chenbetter1996/article/details/83038748