有没有办法将鼠标悬停在一个元素上并影响另一个元素? [英] Is there any way to hover over one element and affect a different element?
本文介绍了有没有办法将鼠标悬停在一个元素上并影响另一个元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望它像这样简单,但我知道它不是:
img {不透明度:0.4;过滤器:阿尔法(不透明度= 40);}图像:悬停{#thisElement {不透明度:0.3;过滤器:阿尔法(不透明度= 30);}不透明度:1;过滤器:阿尔法(不透明度= 100);}
因此,当您将鼠标悬停在 img 上时,它会将 #thisElement 的不透明度更改为 30%,并将图像的不透明度更改为 100%.有没有办法只使用 css 来做到这一点?
这就是 HTML
<头><script type="text/javascript" src="C:UsersShikamaruDocumentsContwined CodingLearningToCodeLearning jQueryjsjquery-1.6.2.min.js"></script><script type="text/javascript" src="briefcase.js"></script><link rel="stylesheet" type="text/css" href="taskbar.css"/><link rel="stylesheet" type="text/css" href="briefcase.css"/><title>公文包</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>头部><身体><div class="mask"></div><div class="float"><div id="album1">专辑名称</div><img class="left" src="bradBeachHeart.JPG" alt="湖边的布拉德"/><img class="left" src="mariaNavi.jpg" alt="制作 Maria Na'vi"/><img class="left" src="mattWaterRun.jpg" alt="Photoshopped Matt"/>
<div class="gradientTop"></div><div class="gradientBottom"></div>