I have three images that I want to overlay (with HTML + CSS, I don't want to use javascript if possible):
This is the result that I would like to achieve:
[Image4]
Here is what I tried:
CSS
.imageContainer { position: relative; } #image1 { position: absolute; top: 0; z-index: 10; border: 1px solid blue; } #image2 { position: absolute; top: 0; z-index: 100; border: 1px solid fuchsia; } #image3 { position: absolute; top: 0; z-index: 1000; width: 10%; height: 10%; border: 1px solid green; }
HTML:
<div class="imageContainer"> <img id="image1" src="http://i.stack.imgur.com/Es4OT.png"/> <img id="image2" src="http://i.stack.imgur.com/WQSuc.png"/> <img id="image3" src="http://i.stack.imgur.com/Xebnp.png"/> </div>
image1 : the "main" image ( image1 should set the maximum height and maximum width for the image. The container is above the HTML above) [blue frame]
image2 : horizontal-align: center;
and top: 0;
relatively image1 [pink frame]
image3 : resized to 10% of its original size, horizontal-align: center;
relative to image1 [green border]
My predilection for HTML + CSS errors led to the following:
I can't figure out how my CSS should be. What should I do to achieve the result, for example [image4]?
source share