I'm trying to find a way to make overlapping images with different positions and sizes responsive with Bootstrap. This is the bootstrap code I have:
<div class="d-flex justify-content-center">
<div class="field-container img-overlay-wrap">
<img src="media/FieldA.png" alt="Field" style="width:100%; opacity:50%">
<img src="media/DIF_1_orange.png" alt="Point" class="mydif1" style="max-width:30px">
<img src="media/DIF_2_orange.png" alt="Point" class="mydif2" style="max-width:30px">
<img src="media/DIF_3_orange.png" alt="Point" class="mydif3" style="max-width:30px">
<img src="media/DIF_4_orange.png" alt="Point" class="mydif4" style="max-width:30px">
<img src="media/DIF_5_orange.png" alt="Point" class="mydif5" style="max-width:30px">
<img src="media/DIF_6_orange.png" alt="Point" class="mydif6" style="max-width:30px">
<img src="media/DIF_7_orange.png" alt="Point" class="mydif7" style="max-width:30px">
<img src="media/DIF_8_orange.png" alt="Point" class="mydif8" style="max-width:30px">
<img src="media/DIF_9_orange.png" alt="Point" class="mydif9" style="max-width:30px">
</div>
</div>
This is my CSS code:enter image description here
.img-overlay-wrap {
position: relative;
display: inline-block; /* <= shrinks container to image size */
transition: transform 150ms ease-in-out;
}
.img-overlay-wrap img { /* <= optional, for responsiveness */
display: block;
max-width: 100%;
height: auto;
}
.img-overlay-wrap svg {
position: absolute;
top: 0;
left: 0;
}
::deep .field-container {
position: relative;
width: 100%;
max-width: 307px;
}
.field-container .mydif1 {
position: absolute;
top: 203px;
left: 138px;
}
.field-container .mydif2 {
position: absolute;
top: 268px;
left: 138px;
}
.field-container .mydif3 {
position: absolute;
top: 195px;
left: 203px;
}
.field-container .mydif4 {
position: absolute;
top: 150px;
left: 168px;
}
.field-container .mydif5 {
position: absolute;
top: 195px;
left: 73px;
}
.field-container .mydif6 {
position: absolute;
top: 150px;
left: 108px;
}
.field-container .mydif7 {
position: absolute;
top: 95px;
left: 63px;
}
.field-container .mydif8 {
position: absolute;
top: 70px;
left: 138px;
}
.field-container .mydif9 {
position: absolute;
top: 95px;
left: 213px;
}
And this is the output of the code:
The goal is to maintain the appearance of the rendered image when the window on the video and therefore the image itself are resized. Is there anyone who can help me solve this problem, preferably without resorting to Java?
If I reduce the window, the background image is reduced, while the overlapping ones remain in their original positions and sizes. I would like them to maintain a consistent appearance.
imgwidthheightandwidth, but alsotopandleft. Or in %. Rather than mixing px and %