I have an image of 400px and a div that is smaller (the width is not always 300px as in my example). I want to center the image in the div, and if there is an overflow, hide it.
Note: I must keep the position:absolute
on the image. I'm working with css-transitions, and if I use position:relative
, my image shakes a bit (https://web.archive.org/web/20120528225923/http://ta6.maxplus.be:8888/).
jsfiddle http://jsfiddle.net/wjw83/1/
See Question&Answers more detail:os