Understanding the scope Attribute in <th>
The scope attribute in a <th> element specifies which cells the header is associated with. It improves accessibility by helping screen readers and other assistive technologies correctly identify header-cell relationships.
col: Applies the header to all cells in the column beneath it.
row: Applies the header to all cells in the row to its right.
colgroup: Applies the header to all cells in a column group defined by <colgroup>.
rowgroup: Applies the header to all cells in a row group defined by <thead>, <tbody>, or <tfoot>.
In short: Use the scope attribute on <th> elements to define whether the header applies to a row, column, or a group. This ensures tables are more accessible and easier to interpret.