0

How to make a div element be behind all the other div elements in CSS?

I am making a shop website and i am making the background more colorful. https://code.sololearn.com/WDcpkC1GZap9/?ref=app

9th Jul 2020, 6:53 PM
SweepSweep2
SweepSweep2 - avatar
3 Respostas
+ 4
using position such as absolute ,relative and z-index for deciding which element to move forward or backward if they are covering up each other suppose there are two div element absolutely positioned and div1 covers div2 ,so if you wanna make div2 cover div1 , value of z-index would be 1 for it or 2
9th Jul 2020, 7:18 PM
Abhay
Abhay - avatar
0
can you please make a code for it as an example?
9th Jul 2020, 8:29 PM
SweepSweep2
SweepSweep2 - avatar
0
<head> <title>Page Title</title> <style> #one{ height:200px; width:200px; position:absolute; background-color:blue; z-index:1; } #second{ height:150px; width:150px; position:absolute; background-color:red; } </style> </head> <body> <div id="one"></div> <div id="second"></div> </body> Second is on top of first div But I made the first div with tag one move forward using z-index:1;
9th Jul 2020, 8:38 PM
Abhay
Abhay - avatar