Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

html

css

hover

fade

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


1 Answers

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;
}
like image 160
Quentin Avatar answered Aug 03 '26 03:08

Quentin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!