Last Updated: February 25, 2016
·
2.254K
· daveobriencouk

Centring an image wider than it's container with CSS

Simple solution on how to centre an image wider than it's container with pure CSS.

This solution was found on stack overflow:

http://stackoverflow.com/questions/3300660/how-do-i-center-an-image-if-its-wider-than-its-container#answer-3302072

And requires two divs to wrap around the image and a little CSS. Here's a working pen:

http://codepen.io/daveobriencouk/pen/Xmzrdw