Html 需要使用CSS选择器选择第二个表的第二行

Html 需要使用CSS选择器选择第二个表的第二行,html,css,Html,Css,我有一个HTML表格,如下所示: <table class="reference notranslate"> <tr>..</tr> . . <tr>..</tr> </table> <table class="reference notranslate"> <tr>..</tr> . . <tr>..</tr>

我有一个HTML表格,如下所示:

<table class="reference notranslate">
  <tr>..</tr>
     .
     .
  <tr>..</tr>
</table>
<table class="reference notranslate">
  <tr>..</tr>
     .
     .
  <tr>..</tr>
</table>
<table class="reference notranslate">
  <tr>..</tr>
     .
     .
  <tr>..</tr>
</table>
我知道XPATH://table[@class='reference nottranslate'][2]/tr[2]

我想选择第二个表的第二行。有人能帮我从同一个地方写CSS选择器吗?

试试这个

table.reference:nth-child(2) tr:nth-child(2)
{
    background-color:red;
}
我知道XPATH://table[@class='reference nottranslate'][2]/tr[2]

我想选择第二个表的第二行。有人能帮忙吗 从同一个位置写入CSS选择器

你是说:

table.reference.notranslate:nth-child(2) tr:nth-child(2)
这将选择第二个表的第二个子代tr元素,该元素同时具有类reference和nottranslate


我需要与xpath等效的css。@Priti-Ahh-ok。这只意味着元素同时具有引用类和非Translate类。看我给你做的这个例子-N-child2的意思是什么?如果你不介意的话,你能告诉我第n种类型2和第n种儿童2之间的区别吗?@Priti不用担心,这里有一个很好的简短答案,它比我在评论xD中解释得更好-
table.reference.notranslate:nth-child(2) tr:nth-child(2)