CSS/JS Solution: On hover of child element, change parent div

后端 未结 5 727
半阙折子戏
半阙折子戏 2021-01-16 04:56

I know CSS is \"cascading\", but in this case I want the effect to ascend. I\'m open for either a JS or CSS solution, but honestly I\'d prefer the solution with the least a

5条回答
  •  鱼传尺愫
    2021-01-16 05:33

    True;

    #word #h:hover {
        background-color: rgba(0, 102, 0, .5); 
    }
    

    False;

    #h:hover #word{
        background-color: rgba(0, 102, 0, .5);
    }
    

提交回复
热议问题