作者:平凡快乐的girl_819 | 来源:互联网 | 2023-05-17 14:27
Inmyscriptthereis3div.Iwanttodisplaydivwithclassabwhenhoveronfirstlineanddispla
In my script there is 3 div. I want to display div with class ab when hover on first line and display div with class abc, when hover on second line. Otherwise I want to diplay div with class a default.
在我的脚本中有3个div。我想在第一行悬停时显示带有类ab的div,并在悬停在第二行时显示带有类abc的div。否则我想用class默认显示div。
But it never display div with class a.
但它永远不会显示与类a的div。
HTML:
HTML:
Show First content!
Show Second content!!
Default Content
First content
Second content
CSS:
CSS:
.abc,.ab {
display: none;
}
#f:hover ~ .ab {
display: block;
}
#f:hover ~ .abc,.a {
display: none;
}
#s:hover ~ .abc {
display: block;
}
#s:hover ~ .ab,.a {
display: none;
}
Here is my fiddle of my problem http://jsfiddle.net/mridulpv/n5fzB/1/
这是我的问题的小提琴http://jsfiddle.net/mridulpv/n5fzB/1/
4 个解决方案