user3057089
user3057089

Reputation:

Fade effect during hover - border-radius doesn't wok

look at this jFiddle with CHROME. Can anyone help me to solve that problem? I don't want to see the corner of the image during transition. I prefer do it without jQuery if it's possible :) Thanks!

CSS

#cf {
  position:relative;
  height:300px;
  width:300px;
  margin:0 auto;  
  border-radius:50%; 
   overflow:hidden;
    border: 10px solid red;
}

#cf img {
  position:absolute;
  left:0;
  -webkit-transition: opacity 1s ease-in-out;
  -moz-transition: opacity 1s ease-in-out;
  -o-transition: opacity 1s ease-in-out;
  transition: opacity 1s ease-in-out;
}

#cf img.top:hover {
  opacity:0;
}

HTML

<div id="cf">
  <img class="bottom" src="http://www.world-science.org/wp-content/uploads/2011/07/Lion_300.jpg" />
  <img class="top" src="http://bioexpedition.com/wp-content/uploads/2012/06/Sea-Turtle-Anatomy.jpg" />
</div>

jFiddle

Upvotes: 3

Views: 591

Answers (1)

Quentin
Quentin

Reputation: 944568

That looks like a bug in Chrome to me.

You can work around it by setting the same border-radius on the image.

#cf img {
  border-radius:50%; 
  overflow:hidden;
}

Upvotes: 3

Related Questions