How can I make divs one below the other with the html and css? -


this question has answer here:

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

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -