我想要的是當我將鼠標懸停在名稱(.teste)中時激活懸停,但是我想用jQuery來完成此操作。當我懸停另一個元素時,如何將懸停樣式應用於div?
li .caixa {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
border: 1px solid #9d9d9d;
border-radius: 10px;
box-sizing: border-box;
height: 210px;
width: 210px;
position: relative;
}
li .hover {
position: absolute;
width: 100%;
height: 100%;
border-radius: 8px;
transition: .3s;
}
li .hover a,
span {
display: none;
}
li .hover:hover {
display: flex;
justify-content: center;
align-items: center;
background-color: #72adde;
opacity: 0.8;
}
<li>
<div class="caixa">
<img src="" alt=""><i class="flaticon-people"></i>
<div class="hover">
<a class="branco" href="">Ver Perfil </a>
<span class="branco"> |</span>
<a class="preto" href=""> Editar</a>
</div>
</div>
<p><a class="teste" href="">Leona Lima</a></p>
</li>
在這種情況下是不是可以包裹在一個標籤的一切,只是做懸停元素的?讓事情更容易 – Extranion