html - Navigation bar rendering over main container rather than above -


so have navigation looks on both mobile , desktop because resizes , accordingly, can't content after go immeadiately below. if don't set padding-top, navigation being set on main_container being rendered under navigation bar , hence not being seen.

i set padding-top property, problem is, mobile desktop site. setting padding-top property makes page rendering in mobile different desktop. leaves more padding in mobile in desktop.

<div id="nav_cont">     <ul id="nav">     <?php         $count=0;         $count++;         ?>         <li><a href="index.php">home</a></li>     <?php         $count++;?>         <li><a href="register.php">register new store</a></li>     <?php          $count++;?>         <li><a href="new_mvi.php">add movie/series/game titles</a></li>         <?php         $count++;?>         <li><a href="myorders.php">orders</a></li>         <?php         $count++;         ?>         <li><a href="editmovies.php?id=<?php echo $storeid;?>">edit movie/series/game titles</a></li>     <?php         $count++;?>         <li><a href="login.php">login store</a></li>     <?php         $count++;?>         <li><a href="cart.php">view cart</a></li>     <?php         $count++;?>         <li><a href="logout.php">logout</a></li>     <?php         $width=100/($count);     ?>     </ul> </div> <style>  #nav li {     display: table-cell;     <?php echo "min-width: $width%; width: $width%; max-width: $width%";?>;     border-right: 1px solid #ccc;     text-align: center; } body {     font-family: 'ubuntu', serif;     padding: 0px;     margin: 0px; } #nav_cont{ } #nav, #nav ul {     position: absolute;     top: 0px;     left: 0px;     width: 100%;     float: left;     margin: 0 0 2em 0;     padding: 0;     background-color: #f2f2f2;     border-bottom: 1px solid #ccc;      border-top: 1px solid #ccc;     display:table; } #nav li:first-child {     border-left: 1px solid #ccc; }  html, body {     height: 100%;     width: 100%;     max-height: 100%;     min-height: 100%; } body, div, table, tr, td, {     padding: 0px;     margin: 0px;     background-color: #ffffff;     border-collapse: collapse; } #page_container{     margin: 0px;     padding: 0px; } #main_container{     margin: 0px; }  <div id="main_container">           <div id="page_container">                  content here <!--this being rendered under navigation bar , hence not being seen-->            </div> </div> 

could point me css should use set right.

thanks.

because set "position: absolute;" on div id="nav" take out of normal document flow, in effect making div id="main_container" first element in document flow , hence positioned @ top. remove "position: absolute;" , main_container positioned below nav.

you can remove "top: 0", "left: 0" , "float: left" don't layout.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -