Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do invisible (display:none) cells count toward colspan

Just wondering. Also, is this applied equally across browsers?

e.g.:

<table><tr>
  <td>asdf</td>
  <td style="display:none;">asdf</td>
  <td>asdf</td>
</tr></table>

does colspan == 2 or 3?

like image 741
Chad Avatar asked Feb 11 '11 17:02

Chad


1 Answers

It is colspan=2

td[colspan] {
  background-color: #ccc;
}
<table border=1>
  <tr>
    <td>TL</td>
    <td style="display:none;">HIDDEN</td>
    <td>TC</td>
    <td>TR</td>
  </tr>
  <tr>
    <td>ML</td>
    <td>MC</td>
    <td>MR</td>
  </tr>
  <tr>
    <td colspan="2">BL + BC</td>
    <td>BR</td>
  </tr>
</table>

You can see it with this example expanded

like image 80
Rafal Avatar answered Nov 03 '22 09:11

Rafal