2 回答

TA貢獻1848條經(jīng)驗 獲得超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條經(jīng)驗 獲得超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 關(guān)注
- 130 瀏覽
添加回答
舉報