I want to have a square image inside a circle.
When the user hovers over the image, the image should scale (zoom in).
The circle should remain the same size.
Only during the CSS transition, the square image overlaps the circle (as if overflow:hidden weren't there at all).
Here's a demo with the weird behavior in Chrome and Safari: http://codepen.io/jshawl/full/flbau
Working ok in firefox.
It appears as though you were styling one too many elements! I've created a fork here
I edited some of your SASS code to utilize the compass library and make better use of the
transition
andtransform
properties which can be seen here:Hopefully this helps! Just think of the
circle
element as the parent container which has general information about the space (e.g.500px
wide and500px
tall). The image itself has a rounded border of500px
. This is the element you want to edit! You can scale and transform this element here without interacting with the parentcircle
container. Reference compass for additional information about using the library! Good luck!Add this code to your parent div and solve problem :
I removed some superfluous markup (the circle and square containers... only needs one) and styled the img itself:
You need to add this code to the parent of your img :
Example here : http://codepen.io/DavidN/pen/dIzJK