Question Top border missing from table when collapsing a row

njsokalski

Well-known member
Joined
Mar 16, 2011
Messages
102
Programming Experience
5-10
I have been told that for tables with the table-layout:fixed; property you should set the widths in the first row and the hide that row, as follows:

<table cellpadding="0" cellspacing="0" style="border-collapse:collapse;table-layout:fixed;">
<tr style="visibility:collapse;"><td style="width:75px;"></td><td style="width:150px;"></td></tr>
<tr><td colspan="2"></td></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td></td></tr>
</table>

I did this, but it caused the top border to be hidden (obviously because of the visibility:collapse;)! I tried placing the widths in one of the rows that is not collapsed, but that did not work because the first row has a colspan="2". What should I be doing, or what am I doing wrong? Thanks.
 
Back
Top