希望这篇文章没有重复。我希望当鼠标停留在 tr[child]:hover
上时,整行都会变颜色。
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
tr[origin]:hover {
background-color: grey;
}
tr[origin]:hover + tr[child]{
background-color: grey;
}
tr[child]:hover {
background-color: grey;
}
</style>
</head>
<body>
<table border="1px">
<tr origin>
<td rowspan="2">1</td>
<td colspan="2">Question</td>
<td rowspan="2">2/3</td>
<td rowspan="2">View answer</td>
</tr>
<tr child>
<td>Rasp 1</td>
<td>Rasp2</td>
</tr>
<tr origin>
<td rowspan="2">1</td>
<td colspan="2">Question</td>
<td rowspan="2">2/3</td>
<td rowspan="2">View answer</td>
</tr>
<tr child>
<td>Rasp 1</td>
<td>Rasp2</td>
</tr>
</table>
</body>
</html>
[child]:hover + tr {background:..}
,但是[child]:hover - tr {background:..}
不存在 :) - G-Cyrillus