I have a div with a bunch of things and I want to make an image centered on it. My basic layout looks something like this:
<div> <img style="display:block; position: absolute; top:50%; left:50%; margin-top:-33px; margin-left:-33px;" src="Images/ajax-loader_001.gif" /> </div>
The above will center the image on the screen (66px x 66px BTW image), but I want it to be centered relative to the parent div and βfloatingβ above it. Is there a purely css way to do this? You must work in IE8 and the latest versions of Firefox.
Edit: just to clarify - I'm looking for the center both horizontally and vertically and above the parent.
source share