當我將鼠標懸停在鏈接上時,我需要爲圖像添加邊框或方塊陰影。懸停應該在圓形圖像周圍顯示動畫圈。我正在使用下面的CSS,但它不工作。在錨點懸停上爲圖像添加邊框或方塊陰影
https://codepen.io/anon/pen/mArEoX
<div class="sub-page-menu-item-w">
<div class="sub-page-menu-img">
<img src="http://dummyimage.com/200x200/0066ff/fff" class="sub-page-menu-imgx img-responsive img-circle">
</div>
<a href="/location/" class="sub-page-menu-a">Location</a>
</div>
.img-circle{
border-radius:100%;
}
.sub-page-menu-a:hover ~ .img-circle {
display: block;
box-shadow: 0 0 0 14px #B28164 !important;
}
.sub-page-menu-a:hover {
color:green !important;
font-size:18px !important;
}
如果你在div後面移動錨點,它不工作https://codepen.io/anon/pen/xELEkq – Learning
這是正確的。我解釋了爲什麼在我的答案中是這樣。 - _「一般的兄弟選擇器(〜)**不會找到位於選擇器左側的元素之前的元素**」_ – Turnip
有沒有辦法通過CSS工作,因爲我不能移動鏈接另一個div – Learning