How can I stack on top of each other two images and center them?

I am trying to place (stack) two images on top of each other as well as center them. Normally using Bootstrap I could give the image a class of “center-block”. The problem is that then appear vertically on top of each other as opposed to stacked directly on top of each other like a stack of paper. To stack them I need to give them a css property of position:absolute. When I do that they move to the left side of the screen and are no longer centered. Any idea how to stack two images and have them centered?

You can see where I am currently at in my codepen:
http://codepen.io/JoJa15/pen/YpQExR?editors=1100

Put each of the images in their own row and column.

I would look into the background image CSS property for this. Otherwise, you’ll probably need to look into position absolute but that can result in other issues depending on how the parent container is positioned (or not).

I need them physically on top off each other and then I can control which one is visible using opacity and z-index. Unless I do not understand your answer correctly putting them in their own row and column would have both images visible at the same time.

I think I have it solved by forcing the images to a certain width say 80% and then using left 10% to position the images. So far it does not look like it is causing any issues and it is looking like it is staying responsive.

Please post the related code while submitting a question.

I couldn’t align the image at all to the center by using bootstrap class–>.center-block. So finally I put an align to the div and enclosed it.

<div align=“center”><img alt=“A picture of Richard Oake” src=“https://upload.wikimedia.org/wikipedia/en/e/e4/Richard_Oakes_(activist).jpg” class=“img-responsive center-block” id=“image-RO”></div>