Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide third element td?

Tags:

html

css

I have the following table:

<table id="test">
 <tr>
  <td>test</td>
  <td>test</td>
  <td>test</td>
 </tr>
 <tr>
  <td>test</td>
  <td>test</td>
  <td>test</td>
 </tr>
</table>

I need to hide third element td using CSS.

As the result I need something like the following HTML:

<table id="test">
  <tr>
    <td>test</td>
    <td>test</td>
  </tr>
  <tr>
    <td>test</td>
    <td>test</td>
  </tr>
</table>

How can I hide the third td in every row?

In tag element not add class or id - need to hide using only CSS.

like image 834
Alex N Avatar asked Jun 12 '13 02:06

Alex N


2 Answers

Try this:

#test tr td:nth-child(3n+3) {
    display: none;
}

Check this fiddle

like image 196
karthikr Avatar answered Sep 30 '22 14:09

karthikr


#test tr td:nth-child(3) { display:none; }
like image 28
Joe Frambach Avatar answered Sep 30 '22 14:09

Joe Frambach