0

I'm using the following code to hide the first child of class.

.remRef {
   display: none
}

.remRef~.remRef {
   display: block
}
<table width="200" border="1">
  <tr>
    <td><a href="javascript:void(0);" class="remRef">link1</a></td>
  </tr>
  <tr>
    <td><a href="javascript:void(0);" class="remRef">link2</a></td>
  </tr>
  <tr>
    <td><a href="javascript:void(0);" class="remRef">link3</a></td>
  </tr>
</table>

It's not working inside the table. Please help me to solve this.

Mukyuu
  • 6,436
  • 8
  • 40
  • 59
NightOwl
  • 329
  • 2
  • 20

1 Answers1

2

Please check below example. hope this helps!

table tr:first-child {
    display: none;
   }
<table width="200" border="1">
    <tr>
      <td><a href="javascript:void(0);" class="remRef">link1</a></td>
    </tr>
    <tr>
      <td><a href="javascript:void(0);" class="remRef">link2</a></td>
    </tr>
    <tr>
      <td><a href="javascript:void(0);" class="remRef">link3</a></td>
    </tr>
  </table>
user10936942
  • 171
  • 1
  • 2
  • I can't use table tr:first-child selector, because I have lot of other columns. This is just a sample code. I need to hide it using class name remRef. – NightOwl Mar 08 '19 at 09:52