css - How can I reorder/simplify HTML code to display on smaller screens? -
i have web page two-column layout desktop screens , html written in particular order achieve desired layout, basic set below:
<div> <div class="left-column"> <h1>heading 1</h1> <p>text here...</p> </div> <div class="right-column"> <img> </div> </div> <!-- columns sit side side --> however, smaller screens, layout has simplified (one column, top > down) i'm finding difficult re-position these elements media queries because of original ordering of html. smaller screens, i'd layout follows:
<div> <h1>heading 1</h1> <img> <p>text here...</p> </div> as can see, want 1 div , <img> move inbetween <h1> , <p> elements.
how can achieve alternate html layout display on smaller screens?
crude solution one's no-script one.
keep duplicate img element in left div between h1 & p. keep dislay:none default. using media queries make visible when wish show single column view & hide other img element or right-column div altogether.
Comments
Post a Comment