I have an <a>
with a <span>
children. I have written some CSS which changes the border-color of the children when the parent is hovered, but it also changes the border-color when I hover the children, which it shouldn't.
a {
padding: 50px;
border: 1px solid black;
}
a span {
position: absolute;
top: 200px;
padding: 30px;
border: 10px solid green;
}
a:hover span {
border: 10px solid red;
}
<a>
Parent text
<span>Child text</span>
</a>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…