Skip to content

Instantly share code, notes, and snippets.

JimBobSquarePants / centered-image.css
Last active December 23, 2015 09:49
Dimension Independent Centred Images - This allows an image to be centered within a parent container of a fixed height no matter what height or width the child image is.
View centered-image.css
* 1: Arbitrary width.
.parent {
position: relative;
height: 250px;
max-width: 400px; /* 1 */
overflow: hidden;