我有一些CSS懸停問題,我做錯了什麼?CSS懸停不能正常工作
我試圖實現,當我把鼠標懸停在圖像上,透明div與其中的鏈接覆蓋它,所以你可以點擊它,並轉到另一個頁面。 類似於此頁面上的東西http://sputniknews.com/當鼠標懸停在新聞上時
當我將鼠標懸停在圖片上時,標記已停用並且懸停顯示不正確。 與此滯留改變代碼很多次了,不知道該怎麼辦
.cvr:hover {
background-color: rgba(0, 0, 0, 0.600);
height: inherit;
width: inherit;
float: left;
position: absolute;
left: 0px;
top: 0px;
visibility: visible;
}
.link {
word-break: normal;
word-wrap: break-word;
display: block;
height: inherit;
width: inherit;
text-align: center;
text-decoration: none;
color: aliceblue;
visibility: hidden;
}
.cvr:hover>.link {
visibility: visible;
}
.img {
width: inherit;
height: inherit;
}
.clear {
clear: both;
}
<div class="person">
<img class="img" src="http://www.gene-quantification.de/logo-img-cz.png">
<div class="cvr">
<a class="link" href="#"> link text is here</a>
</div>
</div>
<div class="person">
<img class="img" src="http://www.gene-quantification.de/logo-img-cz.png">
<div class="cvr">
<a class="link" href="#"> link text is here</a>
</div>
</div>
<div class="clear"></div>