Interesting find by Manuel Matuzovic:
The other day I looked up
colgroup
on MDN […] the demo at the beginning of the page caught my attention. The author adds a class to thecol
element, which does nothing with thecol
element itself, at least not visually, because the element doesn’t get rendered on the page, but it applies the styles from the class to all the cells in the column.
Like so:
See the Pen
Highlight columns in HTML tables with `<colgroup>` by Bramus (@bramus)
on CodePen.
Manuel also shares how to highlight a column upon clicking the table header.