I have the following layout:
<div class="bg">
<div class="header">
<h1>Hello World!</h1>
</div>
</div>
.bg{
background: green;
}
.header{
height: 500px;
}
My goal: add elements(ellipses) behind the header's content by z axis. (see design photo)
This ellipses should be positioned absolute
I tried to this:
<div class="bg">
<div className="ellipse"></div>
<div class="header">
<h1>Hello World!</h1>
</div>
</div>
Then, I positioned .ellipse absolute and gave it z-index: 0, and z-index:1 for .header. Actually, .ellipse is position: absolute, but .header is static. It didn't produce the expected result
You have to set the position of the bg and header elements other then static to be able to use the z-index. You can read about it here.
I've also adjusted the code a bit to mach the image you provided.