Home > OS >  CSS hover affects another element with pseudo after attribute
CSS hover affects another element with pseudo after attribute

Time:03-31

This following css works (it makes visible button2 when hovering on button1)

#btn1:hover ~ #btn2 { visibility: initial;}

But if I want to make the same for the pseudo element #btn2:after, the following code doesn't work

#btn1:hover ~ #btn2:after { visibility: initial;}

Is there a reason or a workaround for it ?

CodePudding user response:

It could be that you need to add the content property to btn2

  • Related