Skip to content Skip to sidebar Skip to footer

How To Create A Circle Hover Reveal When Hovering Over A Picture

I try to create a hover animation when you hover over a png which is the at icon that reveals a circle behind it. But Im not able to complet this. I think u need to do it with help

Solution 1:

Here is a workaround with ::before element.

HTML:

<div class="img-wrapper">
    <img src="Screenshot_2.png" alt="">
</div>

CSS:

.img-wrapper {
    display: inline-block;
    position: relative;
}
.img-wrapper::before {
    position: absolute;
    background: #000;
    width: 100%;
    height: 100%;
    content: "";
    z-index: 1;
    padding: 20px;
    left: -20px;
    top: -20px;
    border-radius: 50%;
    transition: .5s;
    opacity: 0;
    visibility: hidden;
}
.img-wrapper img {
    z-index: 2;
    position: relative;
    display: block;
}
.img-wrapper:hover::before {
    opacity: 1;
    visibility: visible;
}

Thanks


Solution 2:

HTML:

<div class="icon">@<div>

CSS:

.icon::after {
  content: "";
  position: absolute;
  left: 0px;                 /* adujust this value */
  top: 2px;                  /* adujust this value */
  width: 2rem;               /* adujust this value */
  height: 2rem;              /* adujust this value */
  transform: scale(0);
  border-radius: 50%;
  z-index: -1;
  background-image: linear-gradient(
    to top right,
    rgb(25, 68, 255),
    rgb(0, 162, 255)
  );
  transition: all 0.2s ease-out;
}

.icon:hover::after {
  transform: scale(1);
}

Post a Comment for "How To Create A Circle Hover Reveal When Hovering Over A Picture"