6.920 views
hoe kan ik het beste een div "boven op" een andere div leggen? weet dat het kan met position en z-index, maar kom er niet helemaal uit! al vast bedank
#div1 {
position: relative;
width: 100px;
height: 100px;
z-index: 1;
}
#div2 {
position: absolute;
width: 100px;
height: 100px;
z-index: 2;
top: 0px;
left: 0px;
}
#div1 {
position: relative;
background-color: green;
width: 100px;
height: 100px;
z-index: 1;
}
#div2 {
position: absolute;
background-color: red;
width: 100px;
height: 100px;
z-index: 2;
top: 0px;
left: 0px;
}
<html>
<body>
<div id="div1>test</div>
<div id="div2>test</div>
<body>
<html>