是否可以仅通过CSS在tbody
元素上更改thead
元素?我搜索了该主题,但仅涉及父div的内部div元素。
thead th {
background-color: wheat;
}
thead th:hover {
background-color: red;
}
thead th:hover tbody td {
background-color: red;
}
tbody td {
background-color: green;
}
<div class="one">
<table>
<thead><tr><th>qqqqq</th></tr></thead>
<tbody><tr><td>wwwww</td></tr></tbody>
</table>
</div>
答案 0 :(得分:0)
是的,您可以:
thead th {
background-color: wheat;
}
thead th:hover {
background-color: red;
}
thead:hover + tbody td {
background-color: red;
}
tbody td {
background-color: green;
}
<div class="one">
<table>
<thead><tr><th>qqqqq</th></tr></thead>
<tbody><tr><td>wwwww</td></tr></tbody>
</table>
</div>