HTML Table Header using rowspan
html, html-table
Solution
Remove the extra TH in your code
http://jsfiddle.net/yqQsP/
<html>
<body>
<TABLE border="1" >
<CAPTION><EM>A test table with merged cells</EM></CAPTION>
<TR>
<TH colspan="2"> Average</TH>
<TH rowspan="2">Red<BR>eyes </TH>
</TR>
<TR>
<TH>height</TH><TH>weight</TH>
</TR>
<TR>
<TD>1.9<TD>0.003<TD>40%</TD>
</TR>
<TR>
<TD>1.7<TD>0.002<TD>43%</TD>
</TR>
</TABLE>
</body>
</html>
Problem
``` <html> <body> <TABLE border="1" "> <CAPTION><EM>A test table with merged cells</EM></CAPTION> <TR><TH rowspan="2"><TH colspan="2"> Average <TH rowspan="2">Red<BR>eyes </TH> </TR> <TR> <TH>height</TH><TH>weight</TH> </TR> <TR> <TD>1.9<TD>0.003<TD>40%</TD> </TR> <TR> <TD>1.7<TD>0.002<TD>43%</TD> </TR> </TABLE> </body> </html> ``` I'm getting the output with first element of header as blank ``` A test table with merged cells /-----------------------------------------\ | | Average | Red | | |-------------------| eyes | | | height | weight | | |-----------------------------------------| | 1.9 | 0.003 | 40% | | |-----------------------------------------| | 1.7 | 0.002 | 43% | | \-----------------------------------------/ ``` Expected output ``` A test table with merged cells /----------------------------- \ | Average | Red | |-------------------| eyes | | height | weight | | |------------------------------| | 1.9 | 0.003 | 40% | |------------------------------| | 1.7 | 0.002 | 43% | \------------------------------/ ```