我試圖將鼠標懸停在背景圖像上或當它在div
上徘徊時,將文本的顏色更改爲「白色」。我知道,我不得不使用Pseudo
類組合,但只是無法弄清楚。它的確很簡單,我知道。CSS僞類懸停屬性
這是代碼。
.bigbox {
border-bottom: 6px solid #00a37a;
position:relative;
}
.bigbox:hover {
border-bottom: 6px solid #ee5630;
}
.h2title {
padding-left:70px;
margin-top:200px;
position:absolute;
z-index:11;
color:black;
text-decoration:none;
}
.img2 {
opacity:0.2;
margin-bottom:5px;
}
.img2:hover {
opacity:0.9;
margin-bottom:5px;
}
.img2 + h2title:hover {
color:white;
}
<div class="bigbox">
<a class="h2title" href="#"> <h2> Some Text</h2></a>
<center>
<img class ="img2" src="http://www.adweek.com/files/imagecache/node-blog/blogs/istock-unfinished-business-hed-2015.jpg" />
</center>
</div>