0

I have i table like this one in html:

<table>
  <thead>
    <tr>
      <th>Campo</th>
      <th>Valor</th>
    </tr>
  </thead>

  <tbody>

    <tr>
      <th>Marca</th>
      <td>Procelec</td>
    </tr>

    <tr>
      <th>Modelo</th>
      <td>Solfwan</td>
    </tr>

    <tr>
      <th>Tipo Elemento</th>
      <td></td>
    </tr>

  </tbody>
</table>

There are many other fields. I want to create a CSS class to assign it to each tr tag to hide the whole tr if the td tag is empty...

I can't use javascript because I am using a third party app that only allows me to stick html code and CSS...

Is it possible to do this only using HTMl and CSS?

jay
  • 1
  • 3
  • 4
    css does not have parent selector. – Alex Char May 27 '15 at 10:41
  • If you can change the markup, you can use a trick to make the height of the th zero. That way, if the td is empty, the whole tr will collapse. [jsfiddle](http://jsfiddle.net/MrLister/w4L0n4k0/). It works because the table row is as high as the highest cell, so even if the th in a row is 0px high, it's still visible when there's a filled td in the row. – Mr Lister Oct 28 '15 at 13:43
  • I can't change it... – jay Nov 15 '15 at 11:33

0 Answers0