Solution 1 :

You can assign the parent table a class name and use immediate child selector > as followings:

table,th,td {
  border: 1px solid black;
  border-collapse: collapse;
}

th,td {
  padding: 5px;
}


.parent-table > tbody > tr > td:first-child {
/*                    ^^   ^^     */
/* Means 'first "td" child of first order "tr" children of ".parent-table" */
  width: 18%;
  background: red;
}
<table class="parent-table">
  <tr>
    <td>
      <label>Parent first td</label>
    </td>
    <td>
      <table>
        <tr>
          <td>Child first td</td>
          <td>Child second td</td>
        </tr>
      </table>
    </td>
  </tr>
</table>

Solution 2 :

Just add any specific class(like <tr class="t1"> to your parent table’s tr and then use smth like:

.t1>td:first-child { 
  background-color: lime;
}

Thanks for comments.

Problem :

I’m trying to add some css style to the first td element of my parent table only but if i use td:first-child {width: 18%;} it is applying to the child table first td also. So, is there any css selector to select the parent table only ?

table, th, td {
  border: 1px solid black;
  border-collapse: collapse;
}
th, td {
  padding: 5px;
}

td:first-child {
  width: 18%;
  color: red;
}
<table>
  <tr>
    <td>
     <label>Parent first td</label>
    </td>
    <td>
      <table>
        <tr>
          <td>Child first td</td>
          <td>Child second td</td>
        </tr>
      </table>
    </td>
  </tr>
</table>

Comments

Comment posted by combinators

I would suggest you to look at CSS

Comment posted by jsfiddle.net/569nmcwh

Thanks for the answer Harun but it seems it’s not working, here is a fiddle i have created based on your answer –

Comment posted by Harun Yilmaz

Ah you’re right. Modern browsers automatically add

Comment posted by Harun Yilmaz

Won’t this style also be applied to first

Comment posted by Undry

No, if it’s not using the same class, as style will be applied to only first appearance of td after the table with class .t1

Comment posted by this

If you don’t use immediate child selector, it will also be applied to the inner one. You can check

Comment posted by jsfiddle.net/ja62ygkt

@Undry It’s not working, please check this out

By