The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › [Solved] Inline equivalent of background-position?
I have an inline image that I’m trying to horizontally/vertically center inside a div of a smaller size with overflow: hidden, how do I do that by targeting the img tag itself and not using “background-position” on the parent container itself?
If you know the width/height of the image, then it’s pretty easy: http://codepen.io/senff/pen/tfgks
That image is not really centered in Chrome, so you may still need prefixes:
Sweet! Thanks Jacob!