-3
我有此位的代码在这里访问元素的背景属性
.gallery {
margin: 5px;
border: 4px solid rgb(249, 255, 249);
float: left;
width: 320px;
}
.gallery:hover {
border: 4px solid rgb(190, 231, 255);
}
.gallery img {
width: 100%;
height: auto;
}
.description {
padding: 15px;
text-align: center;
}
<div class="gallery">
<a target="_blank" href="#">
<img src="https://upload.wikimedia.org/wikipedia/commons/5/56/TiddlyMap_Demo_Site_-_0.6.4_-_Snapshot_2.png" alt="testImage" width="600" height="400" />
</a>
<div class="description">Description for the image</div>
</div>
我想改变.DESCRIPTION的背景时,名为.gallery:悬停火灾
所以使用'.gallery:hover .description'选择器。 – Xufox
@Xufox刚刚从HTML开始感谢明显的解决方案^^你可以发布它作为答案。 –