Whenever I hover my mouse under the buttons that have drop down menus, the drop down menu shows. I want to make it so the drop down menu only shows when I put my mouse over the actual button.
FIDDLE CODE
HTML
<div id="navbar">
<ul>
<li>Home</li>
<li>Cakes
<ul>
<li >Budget Cakes</li>
<li>Wedding</li>
<li >Cakes to Go</li>
<li >Cake Bonbons</li>
<li >Holiday Cakes</li>
<li >Cakes for Girls</li>
<li >Cakes for Boys</li>
<li >For Her</li>
<li >For Him</li>
<li >Cupcakes</li>
</ul>
</li>
<li>Classes</li>
<li>Flavors</li>
<li>Events
<ul>
<li>Beach Wedding</li>
<li>Baby Showers</li>
<li>Sweet 15-16</li>
</ul>
</li>
<li>Contact</li>
<li>Questions</li>
</ul>
</div><!--end of navbar-->
CSS
#navbar ul li:hover > ul {
height:auto !important;
opacity:1;
}
#navbar ul li:hover > ul > li {
height:50px !important;
opacity:1;
}
#navbar ul {
background: #efefef;
background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: webkit-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.15);
padding: 0 40px;
border-radius:10px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
list-style:none;
position:relative;
display:inline-table;
}
#navbar ul:after {
content:"";
clear: both;
display: block;
}
#navbar ul li {
float:left;
-webkit-transition:background 0.3s ease-in;
-moz-transition:background 0.3s ease-in;
-o-transition:background 0.3s ease-in;
-ms-transition:background 0.3s ease-in;
transition:background 0.3s ease-in;
position:relative;
}
#navbar ul li:hover {
background:#4b545f;
}
#navbar ul li:hover a {
color:#fff;
}
#navbar ul li a {
display:block;
padding:25px 40px;
color:#757575;
text-decoration:none;
}
#navbar ul ul {
background: #5f6975;
border-radius:0px;
-webkit-border-radius:0px;
-moz-border-radius:0px;
padding: 0;
position:absolute;
top:100%;
left:0px;
width:195px;
z-index:1;
-webkit-transition:all 0.4s ease-in-out;
transition:all 0.4s ease-in-out;
opacity:0;
height:0px;
}
#navbar ul ul li {
float:none;
border-top:1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position:relative;
height:0px;
-webkit-transition:all 0.4s ease-in-out;
transition:all 0.4s ease-in-out;
opacity:0;
}
#navbar ul ul li a {
padding: 15px 40px;
color:#fff;
}
#navbar ul ul li a:hover {
background: #4b545f;
}
#navbar {
text-align:center;
}
#navbar ul ul ul {
position:absolute;
left:100%;
top:0;
width:155px;
}
It's because your nested <ul> still has a height, and so when you hover on it, the browser considers that as hovering on part of the first <li>.
Easiest way to fix it is to set the subnav ul to display: block and overflow: hidden.
#navbar ul ul {
...(existing styles)
display: block;
overflow: hidden;
}
Demo
Alternatively, you can toggle visibility: hidden.
#navbar ul ul {
...(existing styles)
visibility: hidden; /* ADD */
}
#navbar ul li:hover > ul {
...(existing styles)
visibility: visible; /* ADD */
}
Demo 2
Add following CSS.
#navbar ul ul {
display: block;
overflow: hidden;
}
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
With this code I have problems because just I have this and I want that those submenus comes over the all menu and then we can select it
If we can see Promedio 2 and promedio 3 are behind of or menu
#charset "utf-8";
#menu2,
#menu2 ul,
#menu2 li,
#menu2 a {
margin: 0;
padding: 0;
border: none;
outline: none;
}
/* menu2 */
#menu2 {
width:850px;
height:33px;
margin:0px;
padding:0px;
font-size:13px;
vertical-align:top;
float:left;
border-top-right-radius:10px;
/*background: -webkit-linear-gradient(top, #7b0100 0%,#7b0100 100%);
background: -moz-linear-gradient(top, #7b0100 0%,#7b0100 100%);
background: -o-linear-gradient(top, #7b0100 0%,#7b0100 100%);
background: -ms-linear-gradient(top, #7b0100 0%,#7b0100 100%);
background: linear-gradient(top, #7b0100 0%,#7b0100 100%);
*/
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#menu2 li:hover{
background:#000066;
color:#FF0;
}
#li_menu{
width:80px;
text-align:center;
padding:0px;
margin:0px;
}
#li_submenu{
text-align:left;
}
#menu2 li {
position: relative;
list-style: none;
float: left;
display: block;
height: 34px;
}
/* Links */
#menu2 li a {
display: block;
padding: 0 14px;
margin: 6px 0;
line-height: 28px;
text-decoration: none;
border-left: 1px solid #CCC;
border-right: 1px solid #9000;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: #FFFFFF;
text-shadow: 1px 1px 1px rgba(0,0,0,.6);
-webkit-transition: color .2s ease-in-out;
-moz-transition: color .2s ease-in-out;
-o-transition: color .2s ease-in-out;
-ms-transition: color .2s ease-in-out;
transition: color .2s ease-in-out;
}
#menu2 li:first-child a { border-left: none; }
#menu2 li:last-child a{ border-right: none; }
#menu2 li:hover > a { color: #FFFF00; }
/* Sub menu2 */
#menu2 ul {
position: absolute;
top: 40px;
left: 0;
opacity: 0;
background: #0000FF;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
-webkit-transition: opacity .25s ease .1s;
-moz-transition: opacity .25s ease .1s;
-o-transition: opacity .25s ease .1s;
-ms-transition: opacity .25s ease .1s;
transition: opacity .25s ease .1s;
}
#menu2 li:hover > ul {
opacity: 1;
}
#menu2 ul li {
height: 0;
overflow: hidden;
padding: 0;
-webkit-transition: height .25s ease .1s;
-moz-transition: height .25s ease .1s;
-o-transition: height .25s ease .1s;
-ms-transition: height .25s ease .1s;
transition: height .25s ease .1s;
}
#menu2 li:hover > ul li {
height: 34px;
overflow: visible;
padding: 0;
}
#menu2 ul li a {
width: 120px;
padding: 4px 0 4px 30px;
margin: 0;
border: none;
border-bottom: 1px solid #4F0002;
}
+++++++++++++++
#menu, #menu ul {
list-style:none;
padding:0;
margin:0;
}
#menu li {
float:center;
position:relative;
line-height: 4.5em;
width: 10em;
}
#menu li ul {
position:absolute;
margin-top:-1em;
margin-left:.5em;
display:none;
}
#menu ul li ul {
margin-top:-3em;
margin-left:7em;
}
#menu a {
display:block;
border-right:0px solid #fff;
color:#FFFFFF;
text-decoration:none;
padding:0 10px;
}
#menu a:hover {
background-color:#0000FF;
color:#fff;
}
#menu ul {
border-top:1px solid #fff;
}
#menu ul a {
border-right:none;
border-right:1px solid #fff;
border-bottom:1px solid #fff;
border-left:1px solid #fff;
background:#0000FF;
}
/* SHOW SUBMENU 1 */
#menu li:hover ul, #menu li.over ul {
display:block;
position: absolute;
}
#menu li:hover ul ul, #menu li.over ul ul {
display:none;
}
/* SHOW SUBMENU 2 */
#menu ul li:hover ul, #menu ul li.over ul {
display:block;
}
+++++++++++++++++++++++++++++++++
<li id="menu">Examenes
<ul>
<li id="menu"><a href="#" >Calendario</a>
<ul id="menu li.over ul">
<li id="menu"><a href="#" >Calendario 1</a>
<ul id="menu li.over ul">
<li id="menu2_ul_li_a"><a href="examen2.php" tag=location_entry>Matematicas</a>
<ul id="menu2_ul_li_a">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
<li>Fisica
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
<li>E. Fisica
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
<li>Artisticas
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
<li>Historia
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
<li>Taller
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</li>
<li>Biologia
<ul>
<li><a href="examen2.php" >1</a></li>
<li><a href="examen2.php" >2</a></li>
<li><a href="examen2.php" >3</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li id="menu"><a href="#" >Promedio 1ero</a>
<ul id="menu li.over ul">
<li id="menu">Español</li>
<li id="menu">Matematicas</li>
<li id="menu li">Fisica</li>
<li id="menu li">E. Fisica</li>
<li id="menu2 li:hover > ul ">Artisticas</li>
<li id="menu li">Historia</li>
<li id="menu li">Taller</li>
<li id="menu li">Biologia</li>
</ul>
</li>
<li id="menu">Segundo
<ul id="menu li.over ul">
<li>Español</li>
<li>Matematicas</li>
<li>Fisica</li>
<li>E. Fisica</li>
<li>Artisticas</li>
<li>Historia</li>
<li>Taller</li>
<li>Biologia</li>
</ul>
</li>
<li id="menu">Tercero
<ul id="menu li.over ul">
<li>Español</li>
<li>Matematicas</li>
<li>Fisica</li>
<li>E. Fisica</li>
<li>Artisticas</li>
<li>Historia</li>
<li>Taller</li>
<li>Biologia</li>
</ul>
</li>
</ul>
</li>
#menu2,
#menu2 ul,
#menu2 li,
#menu2 a {
margin: 0;
padding: 0;
border: none;
outline: none;
}
/* menu2 */
#menu2 {
width:850px;
height:33px;
margin:0px;
padding:0px;
font-size:13px;
vertical-align:top;
float:left;
border-top-right-radius:10px;
/*background: -webkit-linear-gradient(top, #7b0100 0%,#7b0100 100%);
background: -moz-linear-gradient(top, #7b0100 0%,#7b0100 100%);
background: -o-linear-gradient(top, #7b0100 0%,#7b0100 100%);
background: -ms-linear-gradient(top, #7b0100 0%,#7b0100 100%);
background: linear-gradient(top, #7b0100 0%,#7b0100 100%);
*/
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#menu2 li:hover{
background:#000066;
color:#FF0;
}
#li_menu{
width:80px;
text-align:center;
padding:0px;
margin:0px;
}
#li_submenu{
text-align:left;
}
#menu2 li {
position: relative;
list-style: none;
float: left;
display: block;
height: 34px;
}
/* Links */
#menu2 li a {
display: block;
padding: 0 14px;
margin: 6px 0;
line-height: 28px;
text-decoration: none;
border-left: 1px solid #CCC;
border-right: 1px solid #9000;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: #FFFFFF;
text-shadow: 1px 1px 1px rgba(0,0,0,.6);
-webkit-transition: color .2s ease-in-out;
-moz-transition: color .2s ease-in-out;
-o-transition: color .2s ease-in-out;
-ms-transition: color .2s ease-in-out;
transition: color .2s ease-in-out;
}
#menu2 li:first-child a { border-left: none; }
#menu2 li:last-child a{ border-right: none; }
#menu2 li:hover > a { color: #FFFF00; }
/* Sub menu2 */
#menu2 ul {
position: absolute;
top: 40px;
left: 0;
opacity: 0;
background: #0000FF;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
-webkit-transition: opacity .25s ease .1s;
-moz-transition: opacity .25s ease .1s;
-o-transition: opacity .25s ease .1s;
-ms-transition: opacity .25s ease .1s;
transition: opacity .25s ease .1s;
}
#menu2 li:hover > ul {
opacity: 1;
}
#menu2 ul li {
height: 0;
overflow: hidden;
padding: 0;
-webkit-transition: height .25s ease .1s;
-moz-transition: height .25s ease .1s;
-o-transition: height .25s ease .1s;
-ms-transition: height .25s ease .1s;
transition: height .25s ease .1s;
}
#menu2 li:hover > ul li {
height: 34px;
overflow: visible;
padding: 0;
}
#menu2 ul li a {
width: 120px;
padding: 4px 0 4px 30px;
margin: 0;
border: none;
border-bottom: 1px solid #4F0002;
}
+++++++++++++++
#menu, #menu ul {
list-style:none;
padding:0;
margin:0;
}
#menu li {
float:center;
position:relative;
line-height: 4.5em;
width: 10em;
}
#menu li ul {
position:absolute;
margin-top:-1em;
margin-left:.5em;
display:none;
}
#menu ul li ul {
margin-top:-3em;
margin-left:7em;
}
#menu a {
display:block;
border-right:0px solid #fff;
color:#FFFFFF;
text-decoration:none;
padding:0 10px;
}
#menu a:hover {
background-color:#0000FF;
color:#fff;
}
#menu ul {
border-top:1px solid #fff;
}
#menu ul a {
border-right:none;
border-right:1px solid #fff;
border-bottom:1px solid #fff;
border-left:1px solid #fff;
background:#0000FF;
}
/* SHOW SUBMENU 1 */
#menu li:hover ul, #menu li.over ul {
display:block;
position: absolute;
}
#menu li:hover ul ul, #menu li.over ul ul {
display:none;
}
/* SHOW SUBMENU 2 */
#menu ul li:hover ul, #menu ul li.over ul {
display:block;
}
+++++++++++++++++++++++++++++++++
Some important notes:
You really need to clean it up.
Do not repeat id's. They are meant to
be unique.
float: center does not exist
classes with a dot (li.over) are not well supported. Use - or _ (li-over,li_over)
there is more than one way to do this. Here is one. On this solution, you add the class has-submenu to the list element with a submenu
Can someone please help me? I'm trying to center my navigation menu. I have tried different things, but nothing works, and i really don't know what to do. I would really appreciate help. thanks in advance!
nav {
display: inline-block;
list-style-type: none;
float: left;
width: 100%;
height: 102px;
text-align: center;
}
nav > ul {
float:right;
width:100%;
height:102px;
background:#222;
border-radius: 10px 10px 0px 0px;
}
nav > ul > li {
float:left;
width:auto;
margin-right:10px;
line-height:102px;
}
nav > ul li a {
padding:50px;
color:white;
font-family:helvetica, sans-serif;
}
nav > ul > li > ul {
background:#222;
opacity:0;
transition:opacity 1s;
-webkit-transition:opacity 1s;
-moz-transition:opacity 1s;
-o-transition:opacity 1s;
-ms-transition:opacity 1s;
border-radius: 0px 0px 10px 10px;
}
nav > ul > li:hover > ul {
opacity:1;
}
HTML
<div>
<nav>
<ul>
<li> Hjem
<ul>
<li>Sub1</li>
<li>Sub2</li>
<li>Sub3</li>
</ul>
</li>
<li>Bilder</li>
<li>Video</li>
<li>Design</li>
</ul>
</nav>
</div>
Here is what I did.
#outer{
width:100%;
height: 102px;
text-align: center;
background:#222;
border-radius: 10px 10px 0px 0px;
}
nav {
display: inline-block;
list-style-type: none;
margin: 0 auto;
}
nav > ul > li {
float:left;
width:auto;
margin-right:10px;
line-height:102px;
}
nav > ul li a {
padding:50px;
color:white;
font-family:helvetica, sans-serif;
}
nav > ul > li > ul {
background:#222;
opacity:0;
transition:opacity 1s;
-webkit-transition:opacity 1s;
-moz-transition:opacity 1s;
-o-transition:opacity 1s;
-ms-transition:opacity 1s;
border-radius: 0px 0px 10px 10px;
}
nav > ul > li:hover > ul {
opacity:1;
}
And you just need to give an ID to the div.
<div id="outer">
For whatever reason, when I add a radio check into the css, it will appear in the menu but will not show any of the menu items. Any tips on getting it to toggle properly would be a huge help!
Here's the fiddle:
http://jsfiddle.net/casslt07/kjjvp1bx/
**HTML**
<div id="nav">
<nav id="nav" class="clearfix">
<!-- nav menu top level -->
<input type="checkbox" id="menu-toggle">
<label for="button" onclick></label>
<ul class="first-level">
<li>Home
<li><a>Posts</a>
<ul>
<li>Listings</li>
<li>Comics</li>
<li>Observations</li>
<li>Poems</li>
<li>Short Stories</li>
</ul>
</li>
<li>Photos
</li>
<li>Videos</li>
<li>About the Author</li>
</ul>
<?php get_search_form(); ?> </nav>
</div>
**CSS:**
/* Config */
body {font-family:Arial}
ul, li {list-style:none; margin:0; padding:0;}
#menu-toggle {
display:none;
}
#nav label {
display:none;
font-size:20px;
list-style:none;
}
/* Nav */
#nav {
background-color:#33447A;
height: inherit;
border-bottom: 3px solid #13EBC7;
position:relative;
display:block; width: 100%; overflow:visible;}
#nav a {
color:#fff; display:block; font-size: 11pt; padding:18px 20px; text-decoration:none; text-align: left;}
#nav ul li {position:relative;}
/* First-Level */
#nav li {transition:background-color .5s; float:left;}
#nav li:hover {background-color:#50AEED; -webkit-transition: margin-bottom .2s; /* Safari 3.1 to 6.0 */
transition: margin-bottom .2s;}
#nav > ul > li {display:block; float:left; }
/* Second-level */
#nav li ul {width: 100%;}
#nav > ul li:hover > ul {opacity:1; top:54px; visibility:visible; border-radius: 4px; z-index:3; }
#nav .first-level .second-level > li {float:left;}
#nav > ul ul {opacity:0; visibility:hidden; position:absolute; top:60px; transition:all .25s; width:1000px;}
#nav > ul ul li {background-color:#3498db; left:0;}
#nav > ul ul li a {padding:10px 20px}
/* Clearfix */
.clearfix:after {visibility: hidden; display: block; font-size: 0; content:" "; clear:both; height:0;}
.nav-search {
opacity: .25;
width:35%;
float: right;
display:inline;
position: relative;
background: #3498db;
background: url('http://1touchsigns.com/images/search.gif');
background-repeat: no-repeat;
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
border:none;
top:7px;
padding:6px;
outline:none;
transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
-webkit-transition: all .3s ease-in-out;
}
.nav-search:focus {
background: white;
opacity: 1;
}
#responsive {
display: none;
}
#media only screen and (max-width: 480px) {
#menu-toggle {
display:block;
}
#nav label {display: block;height:50px;width:50px;line-height:50px;text-align:center;color:white;font-size:150%;background-color: #83CE69; cursor:pointer;}
#menu-toggle:checked + #nav {display: block;}
#nav label:active #nav {display: none;}
#nav {
display: block;
width: 100%;
height:auto;
float: right;
margin-right: 10px;
background-color: #232323;
border-bottom-width: 0px;
}
#nav ul {
display:none;
}
#nav ul:hover {
display:block;
}
#nav li {
width:100%;
}
#nav ul ul li {
width:100%;
color:white;
background-color:black;
display:block;
}
#nav ul ul li:hover {
display:block;
}
}
Add
#menu-toggle:checked + label + ul {
display: block;
}
http://jsfiddle.net/kjjvp1bx/3/
Or use jQuery, both works:
http://jsfiddle.net/kjjvp1bx/2/
this is sort of a continuation of this solved question.
as you can see in this fiddle the 3rd level dropdown is working but the fix has created this unexplainable single pixel transparent border at the bottom of the dropdowns. You can see it if you look closely between the dropdown and the box-shadow.
html:
<nav id="menu" class="dark_menu">
<!-- Main Nav Start -->
<ul id="main-nav" class="clearfix">
<li id="port" class="parent menu-item">Portfolio
<ul class="clearfix">
<li id="regular" class="parent menu-item">Regular
<ul class="clearfix">
<li id="menu-item-1036" class="menu-item">4 columns
</li>
<li id="menu-item-1033" class="menu-item">3 columns
</li>
<li id="menu-item-1030" class="menu-item">3 columns w/ sidebar
</li>
<li id="menu-item-1029" class="menu-item">2 columns
</li>
</ul>
</li>
<li id="2col" class="parent menu-item">Ajax
</li>
</ul>
</li>
<li id="menu-item-1727" class="parent menu-item">About
<ul class="clearfix">
<li id="menu-item-870" class="menu-item">Who We Are
</li>
<li id="menu-item-872" class="menu-item">What We Do
</li>
</ul>
</li>
</ul>
</nav>
css:
a {
text-decoration:none;
}
ul {
padding-left:0px;
}
#menu {
position:relative;
border:none;
height:auto;
top:34px;
left:0px;
}
#menu ul {
margin:0;
list-style:none;
}
#menu li {
float:left;
position:relative;
}
#menu > ul > li > a {
padding:25px 26px 17px;
border-bottom:3px solid transparent;
margin-right:1px;
color:#6B6B6B;
font:11px Arial, sans-serif;
font-weight:bold;
text-align:center;
text-transform:uppercase;
display:block;
}
#menu > ul > li:hover > a {
color:#F15A2B;
border-color:#F15A2B;
}
#menu > ul li.selected > a, #menu > ul li.selected:hover > a {
color:#3B3B3B;
border-color:#3B3B3B;
}
/* Submenu (second level) */
#menu li > ul {
position:absolute;
top:auto;
left:0;
width:180px;
max-height:0;
box-shadow:1px 2px 10px rgba(100, 100, 100, 0.3);
visibility: hidden;
z-index:99999;
overflow:hidden;
-webkit-transition: max-height 0.2s ease, visibility 0s linear 0.5s;
-moz-transition: max-height 0.2s ease, visibility 0s linear 0.5s;
-o-transition: max-height 0.2s ease, visibility 0s linear 0.5s;
-ms-transition: max-height 0.2s ease, visibility 0s linear 0.5s;
transition: max-height 0.2s ease, visibility 0s linear 0.5s;
background: inherit !important;
}
#menu ul li:hover > ul {
visibility: visible;
max-height: 216px;
transition-delay: 0s;
}
#menu ul li > ul:hover {
overflow:visible;
}
#menu li > ul li {
height:36px;
width:100%;
border-bottom:1px solid #EEE;
padding-top:0;
}
#menu li > ul li:last-child {
border-bottom:none;
}
#menu li > ul li a {
background:#FFF;
padding:11px 15px;
height:35px;
color:#999;
width:100%;
font:10px Arial, sans-serif;
font-weight:bold;
text-align:left;
text-transform:uppercase;
display:block;
}
#menu li > ul li:hover > a {
color:#FFF;
background:#F15A2B;
}
#menu li > ul li.selected > a, #menu li > ul li.selected:hover > a {
color:#3B3B3B;
background:#FFF;
}
/* Submenu (third level) */
#menu li > ul > li > ul {
position:absolute;
top:0 !important;
left:180px !important;
width:180px;
overflow:hidden;
box-shadow:1px 2px 10px rgba(100, 100, 100, 0.3);
visibility:hidden;
}
#menu li > ul > li:hover > ul {
visibility: visible;
}
#menu li > ul > li > ul > li:last-child {
border-bottom:none;
}
#menu li > ul li ul li a {
background:#FFF;
padding:11px 15px;
height:35px;
color:#999;
font:10px Arial, sans-serif;
font-weight:bold;
text-align:left;
text-transform:uppercase;
display:block;
}
#menu li > ul > li > ul > li:hover > a {
color:#FFF;
background:#F15A2B;
}
#menu li > ul li.selected > a, #menu li > ul li.selected:hover > a {
color:#3B3B3B;
background:#FFF;
}
/* Dark Menu */
#menu.dark_menu li ul li {
border-color:#464646;
}
#menu.dark_menu li ul li a {
background:#3B3B3B;
color:#999;
}
#menu.dark_menu li ul li:hover > a {
color:#FFF;
background:#F15A2B;
}
#menu.dark_menu li ul li.selected > a, #menu.dark_menu li ul li.selected:hover > a {
color:#FFF;
background:#3B3B3B;
}
* {
box-sizing:border-box;
-moz-box-sizing:border-box;
}
It looks like adding the following CSS below fixes your issue. If you want to remove the border on the last item, you have to make sure the element does not extend past its child height which is the only element with the background color.
#menu li > ul li:last-child {
border-bottom:none;
height: 35px;
}
This navigation bar I made has drop down menus on certain buttons. I want to make it so when the button that activates the drop down menu is hovered over, the drop down menu sort of falls down into place like this: http://designmodo.com/demo/css3dropdownmenu/
Here's the link to my code: http://jsfiddle.net/w5Ce7/2/
Here's the code just pasted on here:
HTML
<div id="container">
<div id="navbar">
<ul>
<li>Home</li>
<li>Questions</li>
<li>Classes</li>
<li>Designer</li>
<li>Flavors</li>
<li>Cakes
<ul>
<li >Budget Cakes</li>
<li>Wedding
<ul>
<li>Wedding 1</li>
<li>Wedding 2</li>
<li>Wedding 3</li>
<li>Wedding 4</li>
<li>Wedding 5</li>
<li>Wedding 6</li>
</ul>
</li>
<li >Cakes to Go</li>
<li >Cake Bonbons</li>
<li >Holiday Cakes</li>
<li >Cakes for Girls</li>
<li >Cakes for Boys</li>
<li >For Her</li>
<li >For Him</li>
<li >Cupcakes</li>
</ul>
</li>
<li>Events
<ul>
<li>Beach Wedding</li>
<li>Baby Showers</li>
<li>Sweet 15-16</li>
</ul>
</li>
</ul>
</div><!--end of navbar-->
CSS
body {
margin:0;
font-family:Georgia, Arial black, Times, serif;
}
h2 {
text-align:center;
}
img {
border:none;
border:0;
}
#topbanner {
width:100%;
height:40px;
background-color:#88C6CC;
color:#fff;
text-align:center;
line-height:40px;
font-size:36px;
}
#container {
width:1050px;
height:800px;
background-color:#B7E6E8;
margin:auto;
position:relative;
border-radius:20px;
-moz-border-radius:20px;
-webkit-border-radius:20px;
-ms-border-radius:20px;
-o-border-radius:20px;
margin-top:10px;
}
/*Start Navigation Bar*/
#navbar ul ul {
display:none;
}
#navbar ul li:hover > ul {
display:block;
}
#navbar ul {
background: #efefef;
background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: webkit-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
padding: 0 40px;
border-radius:10px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
list-style:none;
position:relative;
display:inline-table;
}
#navbar ul:after {
content: ""; clear: both; display: block;
}
#navbar ul li {
float:left;
-webkit-transition:background 0.3s ease-in;
-moz-transition:background 0.3s ease-in;
-o-transition:background 0.3s ease-in;
-ms-transition:background 0.3s ease-in;
transition:background 0.3s ease-in;
}
#navbar ul li:hover {
background:#4b545f;
}
#navbar ul li:hover a {
color:#fff;
}
#navbar ul li a {
display:block;
padding:25px 40px;
color:#757575;
text-decoration:none;
}
#navbar ul ul {
background: #5f6975;
border-radius:0px;
-webkit-border-radius:0px;
-moz-border-radius:0px;
padding: 0;
position:absolute;
top:100%;
width:195px;
z-index:1;
}
#navbar ul ul li {
float:none;
border-top:1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position:relative;
}
#navbar ul ul li a {
padding: 15px 40px;
color:#fff;
}
#navbar ul ul li a:hover {
background: #4b545f;
}
#navbar {
text-align:center;
}
#navbar ul ul ul {
position:absolute;
left:100%;
top:0;
width:155px;
}
There you go. FIDDLE. The problem was displaying sub ul's as block.
#navbar ul li:hover > ul {
opacity:1;
height:auto !Important;
}
#navbar ul li:hover > ul > li {
height:50px !important;
opacity:1;
}
#navbar ul {
background: #efefef;
background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
background: webkit-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
box-shadow: 0px 0px 9px rgba(0, 0, 0, 0.15);
padding: 0 40px;
border-radius:10px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
list-style:none;
position:relative;
display:inline-table;
}
#navbar ul:after {
content:"";
clear: both;
display: block;
}
#navbar ul li {
float:left;
-webkit-transition:background 0.3s ease-in;
-moz-transition:background 0.3s ease-in;
-o-transition:background 0.3s ease-in;
-ms-transition:background 0.3s ease-in;
transition:background 0.3s ease-in;
position:relative;
}
#navbar ul li:hover {
background:#4b545f;
}
#navbar ul li:hover a {
color:#fff;
}
#navbar ul li a {
display:block;
padding:25px 40px;
color:#757575;
text-decoration:none;
}
#navbar ul ul {
background: #5f6975;
border-radius:0px;
-webkit-border-radius:0px;
-moz-border-radius:0px;
padding: 0;
position:absolute;
top:100%;
left:0px;
width:195px;
z-index:1;
-webkit-transition:all 0.4s ease-in-out;
transition:all 0.4s ease-in-out;
opacity:0;
height:0px;
}
#navbar ul ul li {
float:none;
border-top:1px solid #6b727c;
border-bottom: 1px solid #575f6a;
position:relative;
height:0px;
-webkit-transition:all 0.4s ease-in-out;
transition:all 0.4s ease-in-out;
opacity:0;
}
#navbar ul ul li a {
padding: 15px 40px;
color:#fff;
}
#navbar ul ul li a:hover {
background: #4b545f;
}
#navbar {
text-align:center;
}
#navbar ul ul ul {
position:absolute;
left:100%;
top:0;
width:155px;
}