html - Possible to swap position of div elements using CSS? -
in example there 2 div, wanted first div come down after second div using css let suppose below example
<!doctype html> <html> <head> </head> <body> <div class="div1" > first div. </div> <div class="div2" > second div. </div> </body> </html>
above code give output below
this first div.
this second div.
but wanted output should be
this second div.
this first div.
don't use margin top:20px because text in mycase bigger in example.
here go. use table. must work on 3 elements, container , 2 containing elements.
#container { display:table; width: 100%; } #first{ display:table-footer-group; } #second{ display:table-header-group; }
<div id ="container"> <div id = "first">this first div</div> <div id = "second">this second div</div> </div>
Comments
Post a Comment