2 回答
TA贡献1848条经验 获得超6个赞
这是一个解决方案。您需要遵循正确的选择器链接
#fig1 {
transition: all 500ms ease-in-out;
}
.textcontainer + .gallerycontainer #fig1 {
opacity: 0;
}
.textcontainer:hover + .gallerycontainer #fig1 {
opacity: 1;
}
<div class="textcontainer">
<p> <a id="text1">Important text</a> other text etc </p>
</div>
<div class="gallerycontainer">
<img id="fig1" src="https://image.shutterstock.com/image-photo/black-male-hand-measuring-invisible-260nw-1070365622.jpg"/>
</div>
TA贡献1744条经验 获得超4个赞
希望这可以帮助。
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class="textcontainer">
<p> <a id="text1">Important text</a> other text etc </p>
</div>
<div class="gallerycontainer">
<img id="fig1" src="https://image.shutterstock.com/image-photo/black-male-hand-measuring-invisible-260nw-1070365622.jpg"/>
</div>
</body>
<style>
.gallerycontainer {
opacity: 0.0;
filter: alpha(opacity=40);
}
.textcontainer:hover~.gallerycontainer {
opacity: 1.0;
filter: alpha(opacity=100);
}
</style>
</html>
- 2 回答
- 0 关注
- 87 浏览
添加回答
举报