Use :hover to modify the css of another class?

前端 未结 5 693
旧时难觅i
旧时难觅i 2020-11-29 01:44

Is there a way to modify the css for one class when hovering on an element from another class using only css ?

Something like:

.item:hover .wrapper {         


        
5条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 02:16

    You can do this.
    When hovering to the .item1, it will change the .item2 element.

    .item1 {
      size:100%;
    }
    
    .item1:hover
    {
       .item2 {
         border:none;
       }
    }
    
    .item2{
      border: solid 1px blue;
    }
    

提交回复
热议问题