0

I have such issue, I have something like that:

    <tr>
      <td class="someclass">
        <input />
      </td>
    ...
      <td> </td>
      <td> </td>
     ..
    </tr>

I want to override "someclass" css class that will be applied only to first <td> with <input>. How can I do it? Maybe with parent specification or something like that? Note: I can't add new classes

Pete
  • 54,116
  • 25
  • 104
  • 150
Bohdan Myslyvchuk
  • 1,368
  • 2
  • 14
  • 35

2 Answers2

0

Please try this:

table tr > td:first-child input{
   property: value;
}
Prajwal Shrestha
  • 524
  • 3
  • 12
0

You can use css pseudo class first-child

Supported from IE7 +

.someclass{background:red;}
#table1 tr > td:first-child {background:blue;}
<table id="table1">
<tr>
<td class="someclass">One</td>
<td>Two</td>
<td>Three</td>
</tr>
</table>  

Please refer this link to know more about css selectors

imGaurav
  • 1,003
  • 7
  • 13