[英]Issue on Hovering another element
I'm trying to make an effect on: 我正在尝试对以下方面产生影响:
Hover the image > change the link below's color 将鼠标悬停在图像上>更改下面颜色的链接
But I can't make it work properly. 但是我无法使其正常运行。 I can only make this effect work if I target the whole first container .clearfix
, but how can I make it work in a way that only if I hover the img
and not the whole .clearfix
element, will change the link's color? 我只能以整个第一个容器.clearfix
目标,才能使此效果起作用,但是如何以仅当我将img
而不是整个.clearfix
元素悬停时,才能改变链接的颜色?
.clearfix:hover > ba { color:red; }
<li class="clearfix"> <div class="zitem"><a href="#"><img class="recent_thumb" src="http://lorempixel.com/270/142/sports"/></a></div> <b><a href="#">Random Title text</a></b> <br> </li>
I've also tried these: 我也尝试过这些:
.clearfix:hover + b a { ... }
.clearfix:hover ~ b a { ... }
But it doesn't seem to work or do anything... maybe I'm doing it wrong. 但这似乎没有用或做任何事情……也许我做错了。
Try this 尝试这个
.zitem:hover + b a {
color:red;
}
div
with zitem
class and <b>
element are sibling so sibling selectors (adjacent + or general ~) will work on these. 带有zitem
class和<b>
元素的div
是同级的,因此同级选择器(相邻的+或通用〜)将在这些上起作用。
This will sought out your problem--- 这将找出您的问题-
.zitem:hover + b a {
color:#ff0000;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.