Skip to content

Instantly share code, notes, and snippets.

@robdecker robdecker/1.css
Created Feb 25, 2020

Embed
What would you like to do?
[Vertical align image in overflow:hidden div] #css
div {
position: relative;
overflow: hidden;
}
img {
position: absolute;
top: 50%;
transform: translate(0, -50%);
}
<div>
<img src="some-image.jpg" />
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.