Sometimes, we want to hide or show columns in an HTML table with CSS.
In this article, we’ll look at how to hide or show columns in an HTML table with CSS.
How to hide or show columns in an HTML table with CSS?
To hide or show columns in an HTML table with CSS, we set the display
property.
For instance, we write
table.hide1 .col1 {
display: none;
}
table.hide2 .col2 {
display: none;
}
to add display: none;
to hide the cells with the col1
and col2
classes.
Conclusion
To hide or show columns in an HTML table with CSS, we set the display
property.