How can I make divs one below the other with the html and css? -
this question has answer here:
- div under div 5 answers
i making page , need 1 div block go under other. have lot of different color divs, , when use margin-top:100px(for example) 1 div, , margin-top:200px other div looks ok on computer on lap top different
--- 1st , 2nd divs in right place, have put 3rd 1 below 2nd div. how can that? here pic:

try setting divs "position:relative", set z-index properties. lower it's set farther it's displayed...
example :
<div class="div1"></div> <div class="div2"></div> <div class="div3"></div> then css :
.div1 { position:relative; z-index:1; width: 100%; height: 300px; background-color: #eee; } .div2 { position:relative; z-index:2; margin-top: -100px; width: 100%; height: 300px; background-color: #f90; } .div3 { position:relative; z-index:3; margin-top: -100px; width: 100%; height: 300px; background-color: #ccc; }
Comments
Post a Comment