0

I'm attempting to change a div when hovering ANY anchor link within a document. It only works when it's not inside any other container.

Is there anyway to have this work within a usual page layout (inside body>divs)?

#circle {
  position: fixed;
  border-radius: 50%;
  z-index: 5;
  height: 32px;
  width: 32px;
  background-color: #0081ff;
  pointer-events: none;
  transition:
    background .35s ease,
    box-shadow .35s ease,
    transform .35s ease;
  transform: translate3d(0, 0, 0);
}
  
.circle:hover ~ #circle {
  background-color: transparent;
  box-shadow: 0 0 0 3px #E91E63;
  transform: scale(1) translate3d(0, 0, 0);
}
  
<div> <!--If you remove this DIV, it works-->
<a href="#" class="circle">Circle</a>
</div>

<div id="circle"></div>
gromey
  • 87
  • 1
  • 11

1 Answers1

0

#circle {
  position: fixed;
  border-radius: 50%;
  z-index: 5;
  height: 32px;
  width: 32px;
  background-color: #0081ff;
  pointer-events: none;
  transition:
    background .35s ease,
    box-shadow .35s ease,
    transform .35s ease;
  transform: translate3d(0, 0, 0);
}
  
.circle:hover ~ #circle  {
  background-color: transparent;
  box-shadow: 0 0 0 3px #E91E63;
  transform: scale(1) translate3d(0, 0, 0);
}
<div  class="circle"> <!--If you remove this DIV, it works-->
<a href="#">Circle</a>
</div>

<div id="circle"></div>