html - Divs being pushed down when windows is made smaller -
html - Divs being pushed down when windows is made smaller -
pretty new html , css , i'm having problem described in title. nav pushing downwards div id main.
nav{ width:120px; float:left; margin:0px 5px 0px 5px; #main{ display:inline-block; padding: 1em; float:left; position:relative; min-width: 900px;
any help appreciated, cheers.
edit:
hi guys, maybe should explain better. on page there nav left , div right of it. when windows width made smaller div right beingness pushed below nav instead of remain , it's content beingness displayed off screen.
you have explicitly told element behave that. when set min-width
, width in pixels, telling elements remain same size no matter happens. remove min-width
, set width percentage value 1%
instead of 50px
this: class="snippet-code-css lang-css prettyprint-override">nav { width: 50%; background: red; height: 50px; float:left; } #main { display: inline-block; height:50px; float:left; position: relative; width: 50%; background: black; } body { margin: 0; }
class="snippet-code-html lang-html prettyprint-override"><nav></nav> <div id="main"></div>
html css
Comments
Post a Comment