css - 我如何给 :hover selection to other elements when I'm actually hovering on something other than the element I'm giving the style to?

标签 css

好的,这就是我要在这里实现的目标。

我有这个板子,我正在尝试设计它的样式, 当我将鼠标悬停在 <tr> 上时,我要给color:#fff<a>那是在<tr>里面我在徘徊。

如果我给它是行不通的

tr:hover {color:#fff}

有什么办法可以实现吗?
我似乎找不到合适的选择器。

这是我正在处理的网站 http://lifeto.cafe24.com/xe/request .

最佳答案

试试这个,

tr {
  background: #eee;
}
tr:hover {
  background: #333;
}
tr:hover a {
  color: #fff;
}
<table>
  <tr>
    <td><a href="#">Link 1</a>
    </td>
    <td><a href="#">Link 2</a>
    </td>
  </tr>
</table>

关于css - 我如何给 :hover selection to other elements when I'm actually hovering on something other than the element I'm giving the style to?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35113695/

相关文章:

css - Safari 媒体查询问题的响应式设计

html - 让父 div 继承兄弟高度?

javascript - 使用 jQuery 切换信息

css - 背景图像颜色更改 firefox/chrome

javascript - 将元素推到父级的底部

css - SVG stroke-dashoffset 不适用于 safari

html - 响应式内联 div 中的图像更改相邻 div 的位置

css - 如何在 less 中分离设置和 css?

html - 如何叠加内联定位的 CSS 形状?

css - 包含 div 的 Internet Explorer 7 溢出