How to keep all the parent except the first LI highlighted when the sub LI is hovered over

后端 未结 2 1600
一向
一向 2020-12-22 12:18

HTML:

2条回答
  •  情歌与酒
    2020-12-22 12:37

    You should just change your .active rule to apply to all li elements that are hovered.

    ul.ulSubMenu li:hover,
    .active {
        background-color: #008AAC;
        color: #C5F3FF;
    }
    

    This should work as you want because when you hover over an element, all its parents are hovered as well.

提交回复
热议问题