Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply CSS hover just on visible part of a clipped image

.circle {
  -webkit-clip-path: circle(120px at center);
          clip-path: circle(120px at center);
}

.circle:hover {
  cursor:move;
}
<img src="http://www.publicdomainpictures.net/pictures/10000/nahled/2185-1265776088aCTz.jpg" alt="" class=" circle">

Is there a way to have hover just apply on the visible part of the image?

like image 501
Kai Hartmann Avatar asked Sep 26 '22 16:09

Kai Hartmann


1 Answers

Only what I can see to make it work is to add a wrapper element and apply the clip to that but the hover state to the inner element.

.wrapper {
  display:inline-block;
  -webkit-clip-path: circle(120px at center);
          clip-path: circle(120px at center);
}

.circle {
  display:block;
}

.circle:hover {
  cursor:move;
}
<div class="wrapper"><img src="//placehold.it/300" alt="" class=" circle"></div>
like image 190
Joseph Marikle Avatar answered Oct 12 '22 11:10

Joseph Marikle