当前位置:网站首页>The width of table is 4PX larger than that of tbody

The width of table is 4PX larger than that of tbody

2022-07-07 10:23:00 weixin_ forty-two million one hundred and seventy-eight thousan

table Width ratio tbody The width is large 4px, For example table Set width 1000px, but tbody The width is 996px

solve : Set up table Of border-spacing: 0; that will do , Default border-spacing: 2px;

table {
     border-spacing: 0;}

border-spacing Is the border spacing attribute of the table , Set up boder-spacing: 5px 10px; Is to set the left and right spacing of table cells to 5px, The upper and lower spacing is 10px

In addition, such as setting border by 1px Of td Width is 50px Then I found out that finally td Width is 52px, Settable solution td The problem of width exceeding

td {
     box-sizing: border-box;}
原网站

版权声明
本文为[weixin_ forty-two million one hundred and seventy-eight thousan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070810386909.html