Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When trying to collapse a table the space is still there. In other words collapse renders the same way as hidden on a table. The html code below illustrates the problem:
HTML
<table border="1">
  <tr>
  <td>ABC</td>
  <td>BCD</td>
  </tr>
  <tr style="visibility:collapse">
  <td>..</td>
  <td>...</td>
  </tr>
</table>

<table border="1">
  <tr>
  <td>CDE</td>
  <td>DEF</td>
  </tr>
  <tr style="visibility:hidden">
  <td>..</td>
  <td>...</td>
  </tr>
</table>

What should I do to remove space as wall?
Posted
Updated 24-Nov-11 18:31pm
v2
Comments
JF2015 25-Nov-11 0:31am    
Edited to fix code formatting.

1 solution

According to W3schools[^], visibility:collapse means
Quote:
Only for table elements. collapse removes a row or column, but it does not affect the table layout. The space taken up by the row or column will be available for other content.

If collapse is used on other elements, it renders as "hidden"


So, it's doing exactly as it should.

Peter
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-Nov-11 1:33am    
Good point. And it's clear why it makes sense for tables. My 5.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900