Sometimes, we want to force table column widths to always be fixed regardless of contents with CSS.
In this article, we’ll look at how to force table column widths to always be fixed regardless of contents with CSS.
How to force table column widths to always be fixed regardless of contents with CSS?
To force table column widths to always be fixed regardless of contents with CSS, we make the table layout fixed.
For instance, we write
table {
table-layout: fixed;
width: 100px;
}
to make the table layout fixed with table-layout: fixed;
.
Then all the cells will have the same width.
Conclusion
To force table column widths to always be fixed regardless of contents with CSS, we make the table layout fixed.