html - How can I reorder my divs with CSS? -


given template html cannot modified because of other requirements, how possible display (rearrange) div above div when not in order in html? both divs contain data varies in height , width.

<div id="wrapper">     <div id="firstdiv">         content below in situation     </div>     <div id="seconddiv">         content above in situation     </div> </div> other elements 

hopefully obvious desired result is:

content above in situation content below in situation other elements 

when dimensions fixed easy position them needed, need ideas when content variable. sake of scenario, please consider width 100% on both.

i looking css solution (and have met other solutions if doesn't pan out).

there other elements following this. suggestion mentioned given limited scenario demonstrated -- given might best answer, looking make sure elements following aren't impacted.

this solution uses css , works variable content

#wrapper   { display: table; } #firstdiv  { display: table-footer-group; } #seconddiv { display: table-header-group; } 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -