どうしてこの2つが同等にならないのですか?最初の行は緑色の行を示していますが、2番目の行は表示されていません。唯一の違いはhtmlcにあります。さらに、n番目の子セレクターの特異性は何ですか?
<!DOCTYPE html>
<html>
<head>
<title>Stripe Test</title>
<style type='text/css'>
tr:nth-child(2n+1)
{
background-color: red;
}
tr.c
{
background-color: green;
}
</style>
</head>
<body>
<table class='stripe'>
<tr class='c'>
<td>one</td>
</tr>
<tr>
<td>two</td>
</tr>
<tr>
<td>three</td>
</tr>
</table>
</body>
</html>
-vs-
<!DOCTYPE html>
<html>
<head>
<title>Stripe Test</title>
<style type='text/css'>
tr:nth-child(2n+1)
{
background-color: red;
}
tr .c
{
background-color: green;
}
</style>
</head>
<body>
<table class='stripe'>
<tr class='c'>
<td>one</td>
</tr>
<tr>
<td>two</td>
</tr>
<tr>
<td>three</td>
</tr>
</table>
</body>
</html>