這是我的code.i'm懸停第一個tr在表中上一類背景顏色將不會改變前兩個td在第一tr.but只有當我將第一個tr懸停必須改變一號兩款TD背景顏色會改變,在那裏我錯過了一些code.it的可能只有在CSStd背景顏色不會改變當我徘徊它
.cls{
background-color:red;
}
[data-class*="weeks"]:hover{
background-color:blue;
}
<table border="1px">
<thead>
<tr>
<th>row1</th><th>row2</th><th>row3</th><th>row4</th><th>row5</th>
</tr>
</thead>
<tbody>
<tr data-class="weeks">
<td class="cls">1</td><td class="cls">2</td><td>3</td><td>4</td><td>5</td>
</tr>
<tr data-class="weeks">
<td>6</td><td>7</td><td>8</td><td>9</td><td>10</td>
</tr>
</tbody>
</table>
爲什麼您使用* =在選擇「周」,而不僅僅是=「周」? –
add this like [data-class * =「weeks」]:hover td {background_color:blue; } –
謝謝code.rider – vijay