body{ overflow-y: scroll; padding: 0; margin: 0; }
#header{ text-align: center; margin: 20px 0 20px 0; } /* This header is just in place to make a gap between the top of the page since you said your navigation bar was not at the top */
#nav{ } /* You won't need to add anything into this as you don't want the navigation across the whole webpage */
#nav_wrapper{ width: 600px; margin: 0 auto; text-align: center; }
#nav ul{ list-style-type: none; padding: 0; margin: 0; }
#nav ul li{ background-color: #222; display: inline-block; margin: 0 10px 0 0; }
/* Set the background-color to the 'ul li' instead of the 'ul'
To seperate the 'ul li's from each other you want to add some margin to the left or right, in this case I have added 10px of margin to the right of each li
However, you will want to add '.nav-last' (which will have no margin) to the last 'ul li' in your list to make sure it stays centre */
#nav ul li.nav-last{ margin: 0; }
#nav ul li:hover{ background-color: #333; }
#nav ul li a,visited{ color: #CCC; display: block; padding: 15px; text-decoration: none; }
#nav ul li:hover ul{ display: block; }
#nav ul ul{ position: absolute; display: none; }
#nav ul ul li{ display: block; background-color: #333; margin: 0; } /* You want to make sure these list items do not have margin */
#nav ul ul li a,visited{ color: #888; }
#nav ul ul li a:hover{ color: #FFF; }
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.