I created a child div that forms a colorful triangle shape:
.shape-triangle {
width: 0;
height: 0;
border-left: 25px solid transparent;
border-right: 25px solid transparent;
border-bottom: 50px solid green;
/* placed on top of an image */
position: absolute;
top: 20px;
left: 110px;
}
This colored triangle is nested within a Bootstrap column containing a background image:
<div class="col-12 col-lg-6 text-center">
<div class="shape-triangle"></div>
<img src="assets/background.png" alt="Image">
</div>
The triangle sits above a grayscale shapes background image:
https://i.sstatic.net/kzjY3.png
However, when I resize the screen or browser window, only the background image resizes while the triangle remains fixed in size and position:
https://i.sstatic.net/5l1ZF.png
What adjustments can be made to ensure that the colored triangle maintains proportionality in size and position relative to the background image?