Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is td allowed inside thead?

I have couple of <th> elements within a <thead> element. The first one or one of them is an empty th used as placeholder and does not contain any text. Wave tool gives out an error that th cannot be empty and suggests I change to <td>. Now if I have a <td> within a <thead> it solves the issue and passes html validation too. Is there any reason, I should not be having a <td> within <thead>

like image 248
wallop Avatar asked Oct 29 '22 02:10

wallop


1 Answers

From HTML view:

<td> is allowed inside a <thead>. Permitted content of a <thead> are zero or more <tr> elements. In a <tr> element you can put a <td> and/or <th> element. It doesn’t matter.

From WCAG view:

A table can not have any empty table headers. This can be really confusing for screen reader users. There is one special case: Layout tables. Tables which are only used for "layouting", can have empty <td>'s as "column header". But if i understand your case correctly, you have some other regular table content, so you must add a column header for every column.

So in your case it is not ok to have an empty <td> as column header.

like image 128
nziswiler Avatar answered Nov 09 '22 13:11

nziswiler