html - 将鼠标悬停在将在另一个元素中生效的元素上

标签 html css

我有以下代码:

.tratoresList h3{
    font-family: "opensans-light-webfont";
    font-size: 17px;
    color: #000;
    width: 210px;
    text-align: center;
}
.tratoresList strong{
    font-family: "opensans-extrabold-webfont";
    font-size: 17px;
    color: #000;
    width: 210px;
}
.tratoresList strong, .tratoresList h3:hover{
    font-family: "opensans-extrabold-webfont";
    font-size: 17px;
    color: #a80000;
    width: 210px;
}

这是 HTML,有人能告诉我哪里错了吗?

<ul class="margin-top-50 tratoresList">
<li>
    <img src="./imagens/trator1.png" />
        <h3>linha <strong>4000</strong></h3>

    <div class="tratoresListArrow"></div>
</li>   

当我在 h3 中悬停时,他也必须在 strong 中悬停,反之亦然。

我做错了什么?

最佳答案

.tratoresList h3{
    font-family: "opensans-light-webfont";
    font-size: 17px;
    color: #000;
    width: 210px;
    text-align: center;
}
.tratoresList strong{
    font-family: "opensans-extrabold-webfont";
    font-size: 17px;
    color: #000;
    width: 210px;
}
.tratoresList h3:hover, .tratoresList h3:hover ~ strong{
    font-family: "opensans-extrabold-webfont";
    font-size: 17px;
    color: #a80000;
    width: 210px;
}
<div class="tratoresList">
  <h3>CSS - HOVER AN ELEMENT THAT WILL TAKE EFFECT IN ANOTHER</h3>
  <strong>I THINK ITS POSSIBLE NOW !</strong>
</div>

希望对你有帮助....

关于html - 将鼠标悬停在将在另一个元素中生效的元素上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26858096/

相关文章:

css - 互联网浏览器 : drop down does not display option font family

html - 如何制作粘性导航栏?

ASP.NET 自定义网页控件样式 渲染样式规则

html - 响应时间轴向右移动点

javascript - HTML - 影响固定元素的主体旋转

javascript - Metro 菜单 HTML/CSS/Jquery

javascript - 如何在 React Material UI TextField 中居中占位符和文本

html - Opacity CSS 在 IE7/8 中不起作用,试图将透明输入按钮放在图像上以制作自定义输入按钮

html - 亚马逊为何将CSS放在Head标签中?

html - 将鼠标悬停在图像上,更改另一个图像的 z-index