Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS style elements within <th> scope

In HTML, a table header cell (<th>) can be given a scope attribute to identify whether it is associated with the ensuing column or row or group of them. Is it possible to use a CSS selector to style all table cells (<td>) that are associated with the header cell? I.E., style the entire row if scope="row" or column if scope="column"?

Presupposing the answer is probably "no": then what purpose does the scope attribute serve (other than the CSS [attribute=value] selector)? Does the browser use it for accessibility options? Or should I ignore it as a developer?

like image 933
Aaron Campbell Avatar asked Sep 01 '25 10:09

Aaron Campbell


1 Answers

.tableClass th[scope=col] {
    styleme: beautiful;
}
like image 93
Joakim Avatar answered Sep 03 '25 00:09

Joakim