html - Navbar collides with text -


so i'm creating simple blog-like website record activities summer, , need help. i've created dropdown navbar, runs tag. need move upwards line doesn't run tag. first post on stackoverflow i'm not allowed post pictures, can link picture on imgur. http://imgur.com/u0mtso1

here's html navbar

<nav>     <ul id="menu">         <li><a href="index.html" id="selected">home</a></li>         <li>             <a href="why.html">about</a>             <ul class="hidden">                 <li><a href="why.html">why it</a></li>                 <li><a href="future.html">future plans</a></li>             </ul>         </li>         <li>             <a href="#top">archive</a>             <ul class="hidden">                 <li><a href="#june">june 2015</a></li>                 <li><a href="#july">july 2015</a></li>             </ul>         </li>     </ul> </nav> 

and here's css navbar

/************************* navigation *************************/  /* strip ul of padding , list styling */  nav ul {     list-style: none;     margin: 0;     padding: 0; }  /* create horizontal list spacing */  nav li {     display: inline-block;     float: left;     margin-right: 1px; }  /* style menu links */  nav li {     display: block;     min-width: 140px;     height: 50px;     text-align: center;     line-height: 50px;     color: #fff;     background: #000;     text-decoration: none; }  /* hover state top level links */  nav li:hover {     background: #888888; }  /* style dropdown links */  nav li:hover ul {     background: #f3f3f3;     color: #2f3036;     height: 40px;     line-height: 40px; }  /* hover state dropdown links */  nav li:hover ul a:hover {     background: #888888;     color: #fff; }  /* hide dropdown links until needed */  nav li ul {     display: none; }  /* make dropdown links vertical */  nav li ul li {     display: block;     float: none; }  /* prevent text wrapping */  nav li ul li {     width: auto;     min-width: 100px;     padding: 0 20px; }  /* display dropdown on hover */  nav ul li a:hover + .hidden, .hidden:hover {     display: block; } 

please tell me went wrong.

change hover style use absolute positioning, otherwise you'll push aside later content when hover on menu items:

nav ul li a:hover + .hidden, .hidden:hover {     position: absolute;     display: block; } 

also, should clear on element following nav, appears on new line.

example fiddle here: http://jsfiddle.net/rvs5bs23/1/


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -