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
  • 51,385
  • 23
  • 99
  • 140
Bohdan Myslyvchuk
  • 1,183
  • 2
  • 10
  • 28

2 Answers2

0

Please try this:

table tr > td:first-child input{
   property: value;
}
Prajwal Shrestha
  • 509
  • 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
  • 985
  • 6
  • 11