I am creating a website and need two images to overlay on top of each other, with the top image being centered, however I also need the entire block to be centered in the page so I don’t think I can use absolute positioning as I need the page to be scale-able.
I am using –
img.center { display: block; margin-left: auto; margin-right: auto; }
To center images on the page.
Im not sure if I have explained this very well so hopefully the following mock-ups will help.


I have looked around into image overlaying but they all seem to use absolute positioning and I cant seem to make it work so that the images are always centered using that method.
Is there anyway to do this? if some some example code would be extremely helpful, or just a point in the right direction.
Thanks.
1 Answer