I'm trying to get a menu to appear when hovering over the image, but for some reason it's not appearing. (I'm making it mobile adaptive so the navigation links appear in a hover menu when the browser window is smaller)
Can someone help me figure out why the css rule 'ul.nav-menu:hover' hover isn't working?
#header-nav-menu{
display:hidden;
width:44px;
height:31px;
background:url(https://animalcorner.co.uk/wp-content/uploads/2015/02/elephant-1-720x422.jpg) no-repeat;
margin-left:50px;
}
#header-nav-menu a:hover{
border-radius:4px 4px 0 0;
}
ul.nav-menu{
list-style-type:none;
margin-left: 50px;
font-size:20px;
font-family: Montserrat, Helvetica, Arial, sans-serif;
font-weight:100;
color:#373436;
padding:0;
margin:0 0 0 0;
text-decoration:none;
}
ul.nav-menu li{
display:inline-block;
margin-left:50px;
}
ul.nav-menu a:link{
color:#373436;
text-decoration:none;
}
ul.nav-menu a:visited{
color:#373436;
text-decoration:none;
}
ul.nav-menu a:hover{
color:#2778BA;
}
/* BELOW ADAPTS WITH SMALLER BROWSER WINDOW */
#media (max-width: 960px) {
ul.nav-menu, ul.nav-menu:active{
display:none;
z-index:999999999999999999999999999999999999;
position:absolute;
border:1px solid #f0f;
border-radius: 2px 0 2px 2px;
}
#header-nav-menu{
display:inline-block;
}
/* BELOW NOT WORKING */
ul.nav-menu:hover{
display:block;
}
}
<nav>
<ul class="nav-menu">
<li>Services</li>
<li>About</li>
<li>Contact</li>
</ul>
</nav>
When you hover #header-nav-menu, you want the .nav-menu that comes after it to display. This will do it.
#header-nav-menu{
display:hidden;
width:44px;
height:31px;
background:url(https://animalcorner.co.uk/wp-content/uploads/2015/02/elephant-1-720x422.jpg) no-repeat;
margin-left:50px;
}
#header-nav-menu a:hover{
border-radius:4px 4px 0 0;
}
ul.nav-menu{
list-style-type:none;
margin-left: 50px;
font-size:20px;
font-family: Montserrat, Helvetica, Arial, sans-serif;
font-weight:100;
color:#373436;
padding:0;
margin:0 0 0 0;
text-decoration:none;
}
ul.nav-menu li{
display:inline-block;
margin-left:50px;
}
ul.nav-menu a:link{
color:#373436;
text-decoration:none;
}
ul.nav-menu a:visited{
color:#373436;
text-decoration:none;
}
ul.nav-menu a:hover{
color:#2778BA;
}
/* BELOW ADAPTS WITH SMALLER BROWSER WINDOW */
#media (max-width: 960px) {
ul.nav-menu, ul.nav-menu:active{
display:none;
z-index:999999999999999999999999999999999999;
position:absolute;
border:1px solid #f0f;
border-radius: 2px 0 2px 2px;
}
#header-nav-menu{
display:inline-block;
}
/* BELOW NOT WORKING */
ul.nav-menu:hover{
display:block;
}
}
.wrap {
display: inline-block;
}
.wrap:hover .nav-menu {
display: block;
}
<nav>
<div class="wrap">
<ul class="nav-menu">
<li>Services</li>
<li>About</li>
<li>Contact</li>
</ul>
</div>
</nav>
I would say you want to nav:hover ul { display: block; } so if your mouse is over the <nav> then the menu is visible. Then it's is better possible to click on a menu item.
#header-nav-menu{
display:hidden;
width:44px;
height:31px;
background:url(https://animalcorner.co.uk/wp-content/uploads/2015/02/elephant-1-720x422.jpg) no-repeat;
margin-left:50px;
}
#header-nav-menu a:hover{
border-radius:4px 4px 0 0;
}
ul.nav-menu{
list-style-type:none;
margin-left: 50px;
font-size:20px;
font-family: Montserrat, Helvetica, Arial, sans-serif;
font-weight:100;
color:#373436;
padding:0;
margin:0 0 0 0;
text-decoration:none;
}
ul.nav-menu li{
display:inline-block;
margin-left:50px;
}
ul.nav-menu a:link{
color:#373436;
text-decoration:none;
}
ul.nav-menu a:visited{
color:#373436;
text-decoration:none;
}
ul.nav-menu a:hover{
color:#2778BA;
}
/* BELOW ADAPTS WITH SMALLER BROWSER WINDOW */
#media (max-width: 960px) {
ul.nav-menu, ul.nav-menu:active{
display:none;
z-index:999999999999999999999999999999999999;
position:absolute;
border:1px solid #f0f;
border-radius: 2px 0 2px 2px;
}
#header-nav-menu{
display:inline-block;
}
/* BELOW NOW WORKING */
nav:hover ul{
display:block;
}
<nav>
<ul class="nav-menu">
<li>Services</li>
<li>About</li>
<li>Contact</li>
</ul>
</nav>
Related
I'm fairly new to CSS/HTML and am trying to make a horizontal nav with a dropdown menu. I have made the nav but I am having trouble getting it centred on the page.
#NavigationTop ul{
list-style: none;
position:relative;
margin:0 auto;
padding-right: 1px;
width: 1075px;
}
#NavigationTop ul a{
color:#ffffff;
text-decoration:none;
font-weight:700;
font-size:15px;
padding:0 15px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
line-height: 50px;
text-transform: uppercase;
}
#NavigationTop ul li{
background-color: #343434;
width: 215px;
height: 50px;
position:relative;
float: left;
margin:0 auto;
text-align: center;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
}
#NavigationTop ul li:hover{
background-color: lightseagreen;
}
#NavigationTop ul li a:visited{
color: #ffffff
}
#NavigationTop ul ul{
display:none;
position:absolute;
top:100%;
left:0;
padding:0;
margin: 0;
}
#NavigationTop ul ul li{
float:none;
width:215px;
border-bottom: 1px solid;
}
#NavigationTop ul li:hover > ul{
display: block;
}
<nav id="NavigationTop">
<div id="main-nav">
<ul>
<li>HOME</li>
<li>BIOGRAPHY</li>
<li>DISCOGRAPHY</li>
<li>MEDIA
<ul>
<li>Audio
<li>Video
<li>Photos
</ul>
</li>
<li>CONTACT</li>
</ul>
</div>
</nav>
I'm sure there are many errors, but what could I do to make it centred? Also is it possible to have the nav hide the overflow from the main ul and still show the drop-down menu? Thank you.
Change only this:
#NavigationTop ul {
list-style: none;
position: relative;
margin: 0 auto;
padding-right: 1px;
display: inline-block;
}
div#main-nav {
text-align: center;
}
Whenever you want to make a div center or any html element. you need a container( eg. div or ul or any other) and place the html element inside that container and give specific width to that container with property margin: 0 auto .
By specifying width, your content will not spread across the viewport(brower screen) and when you specify Margin, in shorthand notion( 0 auto ) means 0 will hold the margin for Top & Bottom while auto will hold Left & Right automatically by browser.
Then whatever you will place that container, you can use Floating easily so that your design looks perfect.
Remove the width from #NavigationTop ul
Add specific width till your menu not breaking then add that on #main-nav
#main-nav{
width: 1120px; //in your design case i found it this in px.
margin: 0 auto;
}
#NavigationTop ul{
list-style: none;
position:relative;
margin:0 auto;
padding-right: 1px;
}
#main-nav{
width: 1120px; //in your design case i found it this in px.
margin: 0 auto;
}
#NavigationTop ul{
list-style: none;
position:relative;
margin:0 auto;
padding-right: 1px;
}
#NavigationTop ul a{
color:#ffffff;
text-decoration:none;
font-weight:700;
font-size:15px;
padding:0 15px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
line-height: 50px;
text-transform: uppercase;
}
#NavigationTop ul li{
background-color: #343434;
width: 215px;
height: 50px;
position:relative;
float: left;
margin:0 auto;
text-align: center;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
}
#NavigationTop ul li:hover{
background-color: lightseagreen;
}
#NavigationTop ul li a:visited{
color: #ffffff
}
#NavigationTop ul ul{
display:none;
position:absolute;
top:100%;
left:0;
padding:0;
margin: 0;
}
#NavigationTop ul ul li{
float:none;
width:215px;
border-bottom: 1px solid;
}
#NavigationTop ul li:hover > ul{
display: block;
}
<nav id="NavigationTop">
<div id="main-nav">
<ul>
<li>HOME</li>
<li>BIOGRAPHY</li>
<li>DISCOGRAPHY</li>
<li>MEDIA
<ul>
<li>Audio
<li>Video
<li>Photos
</ul></li>
<li>CONTACT</li>
</ul>
</div>
</nav>
you can try this one https://jsfiddle.net/mnd1b51y/1/
#NavigationTop ul li { position: relative;}
#NavigationTop ul li:hover > ul {
left: 0;
max-width: 210px;
position: absolute;
top: 51px;
}
In #NavigationTop ul class remove padding-left:0 because by default ul takes padding and the default seems to be padding-left:40px for ul.
#NavigationTop ul{
list-style: none;
position:relative;
margin:0 auto;
padding-right: 1px;
width: 1075px;
overflow:auto;
padding-left:0;
}
#NavigationTop ul a{
color:#ffffff;
text-decoration:none;
font-weight:700;
font-size:15px;
padding:0 15px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
line-height: 50px;
text-transform: uppercase;
}
#NavigationTop ul li{
background-color: #343434;
width: 215px;
height: 50px;
position:relative;
float: left;
margin:0 auto;
text-align: center;
border-top: 1px solid #000000;
border-bottom: 1px solid #000000;
}
#NavigationTop ul li:hover{
background-color: lightseagreen;
}
#NavigationTop ul li a:visited{
color: #ffffff
}
#NavigationTop ul ul{
display:none;
position:absolute;
top:100%;
left:0;
padding:0;
margin: 0;
}
#NavigationTop ul ul li{
float:none;
width:215px;
border-bottom: 1px solid;
}
#NavigationTop ul li:hover > ul{
display: block;
}
<nav id="NavigationTop">
<div id="main-nav">
<ul>
<li>HOME</li>
<li>BIOGRAPHY</li>
<li>DISCOGRAPHY</li>
<li>MEDIA
<ul>
<li>Audio
<li>Video
<li>Photos
</ul>
</li>
<li>CONTACT</li>
</ul>
</div>
</nav>
I have a simple horizontal list menu that was working fine when I had a global (*) setting of padding: 0. For other reasons, I needed to take out that padding as a global setting, but I can't figure out how to make it apply to the list.
Now, each entry in the list has a blank block of maybe half an inch to the left of the first entry. If I can get rid of that, I'll be set. Here is a fiddle (http://jsfiddle.net/eha77way/), and I'll paste the code.
Thank you!
CSS
* {
border:0;
margin:0;
}
/* navigation */
#navigation, #episodenav, #pivotnav {
border-top:3px solid #FFF;
border-right:1px solid #FFF;
margin:0 auto;
list-style:none;
}
#pivotnav {
background:#F0F0F0;
border-top:3px solid #FFF;
border-right:1px solid #FFF;
margin:0 auto;
width:755px;
height:25px;
list-style:none;
}
#navigation {
background:#E0E0E0;
width:755px;
height:40px;
}
#episodenav {
width:756px;
background:#F0F0F0;
height:25px;
}
#pivotnav {
width:755px;
background:#F0F0F0;
height:25px;
}
#navigation li, #episodenav li, #pivotnav li {
border-left:1px solid #FFF;
float:left;
list-style:none;
}
#navigation li, #pivotnav li {
width:150px;
}
#episodenav li {
width:41px;
}
#navigation a, #episodenav a, #pivotnav a {
color:#000;
display:block;
text-align:center;
}
#navigation a {
line-height:40px;
}
#episodenav a, #pivotnav a {
line-height:25px;
}
/* content */
#content {
height:auto;
margin:50px auto;
position: relative;
padding:30px;
width:751px;
background: white;
-moz-box-shadow: 0 0 20px black;
-webkit-box-shadow: 0 0 20px black;
box-shadow: 0 0 20px black;
font-family: ‘Palatino Linotype’, ‘Book Antiqua’, Palatino, serif;
}
#content h1 {
border-bottom:1px dashed #999;
font-size:2em;
padding:25px 5px;
font-family: ‘Trebuchet MS’, Helvetica, sans-serif;
}
#content h2 {
font-size:1.6em;
padding:25px 5px;
font-family: ‘Trebuchet MS’, Helvetica, sans-serif;
}
#content h3 {
font-size:1.1em;
padding:20px 5px;
font-family: ‘Trebuchet MS’, Helvetica, sans-serif;
}
#content p {
padding: 10px 5px;
line-height: 21px;
}
#content textarea {
border: 1px solid #cccccc;
}
#list {
margin-left: 50px;
}
HTML
<body>
<div id="content">
<div id="navigation">
<ul>
<li><i>Ulysses</i> by Episode</a></li>
<li>Pivot Points</a></li>
<li>Projects</a></li>
<li>Collections</a></li>
<li>About Ashplant</a></li>
</ul>
</div>
<h2>TEST</h2>
</div>
</body>
</html>
Is this what you mean?
#navigation ul{
padding: 0;
}
The padding is in the ul element, not the lis. This is a default of the browser, that is much needed when bullets are visible.
You can add a css rule-set such as:
#navigation ul {
padding: 0;
}
at least on my jsbin, this does the trick.
Maybe you want to remove padding-left without {padding-left:0px}?
Please use it
ul > li {position: relative; left: -20px;}
I have a dropdown menu which works exactly as expected in Chrome.
The dropdown list is with position absolute, and the parent with position relative. However, it seems to render differently in Firefox. The dropped menu appears to be relative to the ul element rather than the li element
This dropdown is activated using javascript, adding a display:block on click
Any ideas why?
I did not use a table.
Fiddle
http://jsfiddle.net/eyJ8e/1/
HTML
<div id="menubar">
<div class="container">
<ul class="menu-container title" style="float:left;">
<li>NEW
</li>
<li class="dropdown"> <a class="click-dropdown" href="#">MEN</a><span class="caret"></span>
<ul class="dropdown-menu" style="display:block"> <li>Jeans</li>
<li>Pants</li>
<li>Shirts</li>
<li>Shorts</li>
<li>Tees</li>
</ul>
</li>
</ul>
</div>
</div>
CSS
body
{
width: 100%;
margin: 0px;
padding: 0px;
font-family: Calibri, Candara, Segoe, "Segoe UI", Optima, Arial, sans-serif;
font-size: 10pt;
/* background-color: #f0f0f0; */
}
.title{
/*font-family: Impact, Charcoal, sans-serif;*/
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
text-transform: uppercase;
font-family: SourceSans Pro Bold;
}
.container{
width:1024px;
margin:0 auto;
}
a, a:active, a:visited
{
color: #000000;
text-decoration: none;
outline: none;
}
a:hover
{
text-decoration: none;
}
#menubar {
width:100%;
min-width:1000px;
height:75px;
background-color:#000;
line-height: 75px;
color:white;
}
#menubar .brand{
display: block;
height:75px;
width: 120px;
margin-right:30px;
margin-top:3px;
float:left;
color:white!important;
}
#menubar .menu-container{
list-style:none;
margin:0px;
}
#menubar .menu-container li:first{
border-left: 1px solid grey;
}
#menubar .menu-container li{
position:relative;
display:inline;
padding:0px 15px;
font-size: 14px;
text-transform: uppercase;
border-right: 1px solid grey;
height:75px;
}
#menubar .menu-container > li.shopping-bag-wrapper:hover{
text-decoration: none;
}
#menubar .menu-container li.shopping-bag-wrapper{
border-right:none;
padding-right:0px;
}
#menubar .authentication-fb-form{
display:inline;
}
#menubar .menu-container li a{
color: white!important;
}
#menubar .menu-container li:last-child{
border:none;
}
#menubar .menu-container .dropdown ul.dropdown-menu > li:hover{
background-color:#555555;
}
#menubar .menu-container ul.dropdown-menu{
border:none;
position:absolute;
z-index:1000;
background-color:black;
display:none;
margin-top:-20px;
}
#menubar .menu-container .dropdown-menu li{
display:block;
min-width:150px;
max-width: 250px;
height:auto;
}
#menubar .menu-container .dropdown-menu a{
display:block;
line-height:25px;
padding: 5px 0px;
height:auto;
border: 2px solid white;
border-bottom:0px;
}
#menubar .menu-container .dropdown-menu a:last-child{
border: 2px solid white;
}
ul{
list-style: none;
margin:0px;
padding:0px;
}
.inline-block{
display: inline-block;
}
.pull-right{
float:right!important;
}
.caret{
display: inline-block;
width: 0;
height: 0;
margin-left: 2px;
vertical-align: middle;
border-top: 4px solid;
border-right: 4px solid transparent;
border-left: 4px solid transparent;
}
There are a couple of issues here. Firstly, you are nesting <li>'s within <a>'s which is invalid. You need to fix this:
<ul class="dropdown-menu">
<li>Jeans</li>
<li>Pants</li>
<li>Shirts</li>
<li>Shorts</li>
<li>Tees</li>
</ul>
secondly, you arent actually giving your nested <ul> a left position which FF seems to need:
#menubar .menu-container ul.dropdown-menu{
left: 0;
}
You will then also need to move your border from the <a> to the <li> to keep the styling that you had before making these changes.
DEMO
just put left:0 in #menubar
.menu-container ul.dropdown-menu{left:0}
refer http://jsfiddle.net/aashi/eyJ8e/8/
For a drop down menu you may check this demo link :
The html part:
<ul class="menubar">
<li>NEW</li>
<li>MENU
<ul class="dropmenu">
<li>JEANS</li>
<li>PANTS</li>
<li>SHIRTS</li>
<li>SHORTS</li>
<li>TEES</li>
</ul>
</li>
</ul>
the CSS part:
*{ margin:0; padding:0;}
ul.menubar{
margin:0 auto;
width:100%;
background:#000;
height:40px;
display:block;
}
ul.menubar li{
list-style-type:none;
display:inline-block;
float:left;
position:relative;
}
ul.menubar li a{
display:block;
text-decoration:none;
color:#fff;
padding:10px;
}
ul.menubar li ul.dropmenu{
position:absolute;
width:120px;
padding:10px 10px 10px 0;
display:none;
}
ul.menubar li:hover ul.dropmenu{
display:block;
top:30px;
}
ul.menubar li:hover ul.dropmenu li{
background:#222;
width:100%;
}
ul.menubar li:hover ul.dropmenu li a:hover{
background:#333;
}
Here is the JS fiddle:
http://jsfiddle.net/ameysawant/LPdqV/1/
so I've having problems with a 3-layer css dropdown menu. Levels 1 and 2 work just fine, but three is not showing up properly, I would like level three to branch to the right. Level three is the Anti-Matter and Deuterium tabs that should come from the "Fuel" link.
I have a jsfiddle with my problem. For those of you who cannot get it to work my code is below.
http://jsfiddle.net/IanLueninghoener/fD9eF/
Thanks everyone!
Here's my html:
<div id="nav">
<ul>
<li id="firstNavItem"><a href="index.html">Home</li>
<li>Warp
<ul>
<li>How it works</li>
<li>Warp Engine</li>
<li>Warp Factors</li>
<li>Fuel
<ul>
<li>Anti-Matter</li>
<li>Deuterium</li>
</ul>
</li>
</ul>
</li>
<li><a href="Fact-or-Fiction.html">Fact or Fiction</li>
<li>Star Trek
<ul>
<li>Enterprise</li>
<li>Voyager</li>
</ul>
</li>
<li>About</li>
</ul>
</div>
CSS:
/* Reset */
* {
margin:0px;
padding:0px;
}
.clearFix {
clear: both;
}
/* Container */
#container {
width: 960px;
margin: 50px auto;
}
/* Red */
/* Navigation First Level */
#nav{
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
font-size:15px;
}
#nav ul{
background:#000000;
height:35px;
list-style:none;
border: 3px solid #000000;
-webkit-border-radius: 6px;
}
#nav li{
float:left;
padding:0px;
}
#nav li a{
background:#000000;
display:block;
text-align:center;
text-decoration:none;
color:#fff;
line-height:35px;
padding:0px 25px;
-webkit-border-radius: 6px;
}
#nav li a:hover{
text-decoration:none;
background: #4873b1;
color:#FFFFFF;
-webkit-border-radius: 3px;
}
/* Navigation Second Level */
#nav li ul{
position:absolute;
background:#000000;
display:none;
height:auto;
width:210px;
-webkit-border-top-left-radius: 0px;
-webkit-border-top-right-radius: 0px;
margin-left:-3px;
}
#nav li:hover ul{
display:block;
}
#nav li li:hover {
font-weight: 800;
}
#nav li li {
display:block;
float:none;
width:210px;
}
#nav li ul a{
text-align:left;
display:block;
height:35px;
padding:0px 10px 0px 25px;
}
/* Red */
/* Navigation First Level */
#nav_red{
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
font-size:15px;
}
#nav_red ul{
background:#cfcfcf;
height:40px;
list-style:none;
}
#nav_red li{
float:left;
padding:0px;
}
#nav_red li a{
background:#cfcfcf;
display:block;
text-align:center;
text-decoration:none;
color:#333;
line-height:40px;
padding:0px 25px;
}
#nav_red li a:hover{
text-decoration:none;
background: #915fa6;
color:#FFFFFF;
}
/* Navigation Second Level */
#nav_red li ul{
position:absolute;
background:#000000;
display:none;
height:auto;
width:210px;
}
#nav_red li:hover ul{
display:block;
}
#nav_red li li:hover {
font-weight: 800;
}
#nav_red li li {
display:block;
float:none;
width:210px;
}
#nav_red li ul a{
text-align:left;
display:block;
height:40px;
padding:0px 10px 0px 25px;
}
/* Slim */
/* Navigation First Level */
#nav_slim{
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
font-size:14px;
}
#nav_slim ul{
background:#84b41f;
height:25px;
list-style:none;
border: 3px solid #84b41f;
-webkit-border-radius: 4px;
}
#nav_slim li{
float:left;
padding:0px;
}
#nav_slim li a{
background:#84b41f;
display:block;
text-align:center;
text-decoration:none;
color:#333;
line-height:25px;
padding:0px 25px;
-webkit-border-radius: 4px;
}
#nav_slim li a:hover{
text-decoration:none;
background: #315907;
color:#FFFFFF;
-webkit-border-radius: 2px;
}
/* Navigation Second Level */
#nav_slim li ul{
position:absolute;
background:#84b41f;
display:none;
height:auto;
width:210px;
-webkit-border-top-left-radius: 0px;
-webkit-border-top-right-radius: 0px;
margin-left:-3px;
}
#nav_slim li:hover ul{
display:block;
}
#nav_slim li li:hover {
font-weight: 800;
}
#nav_slim li li {
display:block;
float:none;
width:210px;
}
#nav_slim li ul a{
text-align:left;
display:block;
height:25px;
padding:0px 10px 0px 25px;
}
Three steps and you have your 3 levels dropdown.
First, when hovering your 1st level, you only want to show the 2nd one. So instead of having #nav li:hover ul, you should have #nav li:hover > ul.
Second, if you want to be able to have your 3rd level at right of its parent, you will need to set its position to relative so add position:relative; in your class #nav li li
Finally, to show you 3rd level at right of its parent, you will have to add a new style:
#nav li li ul{
position:absolute;
top:0;
left:100%;
}
Here is your updated jsfiddle having a good looking 3 levels dropdown.
I can't seem to be able to center the horizontal #menu in the center of the page.
I have tried adding a container DIV, but I can't seem to be able to get it to work at all.
Here is my HTML markup:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
#container {
margin:0 auto;
width: 100%;
}
#menu {
list-style:none;
width:940px;
height:43px;
background: #014464;
border: 1px solid #002232;
}
#menu ul, li {
font-size:14px;
font-family: Segoe UI;
line-height:21px;
text-align:left;
}
#menu li {
float:left;
display:block;
text-align:center;
position:relative;
padding: 4px 10px 4px 10px;
margin-right:30px;
margin-top:7px;
border:none;
}
#menu li:hover {
border: 1px solid #777777;
padding: 4px 9px 4px 9px;
background: #F4F4F4;
}
#menu li a {
color: #EEEEEE;
display:block;
outline:0;
text-decoration:none;
}
#menu li:hover a {
color:#161616;
}
.dropdown_column {
margin:4px auto;
float:left;
position:absolute;
left:-999em; /* Hides the drop down */
text-align:left;
padding:10px 5px 10px 5px;
border:1px solid #777777;
border-top:none;
background:#F4F4F4;
width: 560px;
}
#menu li:hover .dropdown_column {
left:-1px;
top:auto;
}
.sub_col { width:130px; }
.col { width:550px; }
.sub_col, .col {
display:inline;
float: left;
position: relative;
margin-left: 5px;
margin-right: 5px;
}
#menu .menu_right {
float:right;
margin-right:0px;
}
#menu li:hover .align_right {
left:auto;
right:-1px;
top:auto;
}
#menu ul li {
line-height:21px;
text-align:left;
}
#menu h2 {
font-size:21px;
font-weight:400;
letter-spacing:-1px;
margin:7px 0 14px 0;
padding-bottom:14px;
border-bottom:1px solid #666666;
}
#menu h3 {
font-size:14px;
margin:7px 0 14px 0;
padding-bottom:7px;
border-bottom:1px solid #888888;
}
#menu li:hover div a {
font-size:12px;
color:#015b86;
}
#menu li:hover div a:hover {
color:#FFF;
background: #014464;
}
#menu li ul {
list-style:none;
padding:0;
margin:0 0 12px 0;
}
#menu li ul li {
font-size:12px;
line-height:24px;
position:relative;
text-shadow: 1px 1px 1px #ffffff;
padding:0;
margin:0;
float:none;
text-align: left;
width:130px;
}
#menu li ul li:hover {
background:none;
border:none;
padding:0;
margin:0;
}
</style>
</head>
<body>
<div id="container">
<ul id="menu">
<li>4 Columns<!-- Begin 4 columns Item -->
<div class="dropdown_column"><!-- Begin 4 columns container -->
<div class="col">
<h2>This is a heading title</h2>
</div>
<div class="sub_col">
<h3>Some Links</h3>
<ul>
<li>ThemeForest</li>
<li>GraphicRiver</li>
<li>ActiveDen</li>
<li>VideoHive</li>
<li>3DOcean</li>
</ul>
</div>
<div class="sub_col">
<h3>Useful Links</h3>
<ul>
<li>NetTuts</li>
<li>VectorTuts</li>
<li>PsdTuts</li>
<li>PhotoTuts</li>
<li>ActiveTuts</li>
</ul>
</div>
<div class="sub_col">
<h3>Other Stuff</h3>
<ul>
<li>FreelanceSwitch</li>
<li>Creattica</li>
<li>WorkAwesome</li>
<li>Mac Apps</li>
<li>Web Apps</li>
</ul>
</div>
<div class="sub_col">
<h3>Misc</h3>
<ul>
<li>Design</li>
<li>Logo</li>
<li>Flash</li>
<li>Illustration</li>
<li>More...</li>
</ul>
</div>
</div><!-- End 4 columns container -->
</li><!-- End 4 columns Item -->
</ul>
</div>
</body>
</html>
Add margin: 0 auto; to your #menu ul.
DEMO
Wrap the menu in div with style text-align: center