html - CSS Flexbox on mobile messes up boxes -
i working on converting on flexbox , struggle lot. of so, able started , struggle part. works perfectly, far, except when view page on iphone 4 or samsung 3, messes up. on desktop, can resize , peachy, mobile, well, doesn't work well. have reduced as possible make shorter here. logo works fine, head_area , head_note drop underneath logo obviously. don't want. sure simple fix, daunting me @ moment. great appreciated.
* { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } html,body,address,blockquote,div, form,fieldset,caption, h1,h2,h3,h4,h5,h6, hr,ul,li,ol,ul,dd,dt, table,tr,td,th,p,img { margin: 0; padding: 0; } img,fieldset { border: none; } body { color: #cf6; margin: 0 auto; font-size: 1.0em; max-width: 1280px; overflow-y: scroll; text-transform: uppercase; font-family: "tahoma", verdana, sans-serif; background: #777 url(../homepics/homeback.jpg) top center; } #head_main { height: 112px; margin-bottom: -112px; border: 2px solid #444; background: #555 url(../homepics/homemenu2.png) 0 0 repeat-x; } #head_wrap { width: 92%; display: flex; margin: 0 auto; max-width: 84em; flex-flow: row wrap; } #head_logo { top: 0; left: 0; width: 77px; height: 90px; height: 112px; background: url(../homepics/homelogo.png) 0 0 no-repeat; } #head_area { flex: 2; display: flex; min-width: 5em; flex-direction: column; } #head_info { color: #0ff; height: 45px; font: normal 125%/45px arial, helvetica, sans-serif; } #head_news { margin-top: 0; padding: 0 10px; font-weight: 600; } #head_news li { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } #head_note { top: 0; width: 77px; height: 112px; } @media (max-width: 40em) { #head_main { margin: 0; padding: 0; border: 1px solid pink; } #head_wrap { width: 100%; } #head_logo { border: 1px solid yellow; } #head_area { flex: auto; display: flex; -webkit-flex-direction: column; border: 1px solid red; } .head_menu { border: 1px solid blue; } #head_info { border: 1px solid cyan; } #head_note { border: 1px solid orange; } }
<head> <meta http-equiv="x-ua-compatible" content="ie=edge"/> <meta name="viewport" content="width=device-width; initial-scale=1.0"/> </head> <body> <!-- header --> <header id="head_main"> <section id="head_wrap"> <article id="head_logo"> </article> <article id="head_area"> <div id="head_info"> <!-- here --> </div> <div class="head_menu"> <!-- here --> </div> </article> <article id="head_note"> <!-- here --> </article> </section> </header> <aside> <!-- here --> </aside> <footer> <!-- here --> </footer> </body>
you can use flex display bigger viewports only. way columns won't displayed side side, instead, 1 below other on tabs , mobiles. doing may help:
.row { display: flex; } @media screen , (max-width: 1024px) { .row { display: initial !important; } }
Comments
Post a Comment