I am attempting to absolutely position an image on top of a parent div. The image has been given a negative zIndex (zIndex: -1) in order to simulate a background image (it has to be this way). This parent div contains two child divs with two separate background-colors. I have tried giving the parent container a zIndex, but the image is still being hidden behind the children's background colors. My desired result is an absolutely positioned image that maintains a -zIndex that is not hidden behind the background colors of the child divs. Keep in mind, if there is text in the child divs I don't want the image to cover that text. My code is as follows:
<div style={{ positon: "relative", zIndex: 0 }}>
<div style={{ backgroundColor: "red", height: 500, width: "100%" }}>TEXT</div>
<div
style={{ backgroundColor: "blue", height: 500, width: "100%" }}
>TEXT</div>
<div
style={{
backgroundRepeat: "no-repeat",
backgroundPosition: "cover",
backgroundImage: `url(${Squiggle1})`,
height: 600,
width: 451,
position: "absolute",
top: 250,
bottom: 0,
right: 0,
zIndex: -1
}}
/>
</div>