我试图将鼠标悬停在背景图像上或当它在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>