CSS/HTML Drop Menu going away after moving mouse - html

I have a menu and some of my links have dropdown menus. Hovering over the link brings down the dropdown menu, but if I move my cursor onto the actual dropdown menu, the dropdown menu disappears.
Please help!
Here is the CSS and HTML of the actual menu:
CSS:
.menu ul {
color: #3d3d3d;
text-align: right;
float: right;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
}
.menu ul li {
font-family: LemonMilk;
font-size: 24px;
font-weight: bold;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
.menu ul li:hover {
color: #0096ff;
}
.menu ul li ul {
padding: 0;
position: absolute;
background-color: rgba(0,0,0, 0.5);
margin-top: 5px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
.menu ul li ul li {
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
font-size: 16px;
}
.menu ul li ul li:hover { background-color: rgba(0,0,0, 0.9); }
.menu ul li:hover ul {
color: #0096ff;
display: block;
opacity: 1;
visibility: visible;
text-decoration: none;
}
.menu ul li a {
color: #3d3d3d;
}
.menu ul li a:hover {
color: #0096ff;
}
.menu ul li ul li a {
color: #fff;
}
.menu ul li ul li a:hover {
color: #0096ff;
}
HTML:
<header>
<div class="wrapper">
<div id="clogo"></div>
<span class="menu">
<ul id="dropnav">
<li><a href="/forums/index.php" />Forums</a></li>
<li>Members
<ul>
<li>Member List</li>
<li>Staff List</li>
</ul>
</li>
<li>Donate<br>
<ul>
<li>Buycraft</li>
<li>Buy Credits</li>
<li>CL Plus</li>
</ul>
</li>
</ul>
</span>
</div>
</header>

Consider to use > selector in the CSS, so it only looks one level down the markup structure, no deeper. A demo that made similar to your style - http://jsfiddle.net/55nw4wmy/
.class ul li {
affects all levels of <li> inside.
}
.class > ul > li {
only affects the first level.
}
.class > ul > li > ul > li {
only affects the second level.
}
That way, you don't have to overwrite the rules continually. And for the drop down disappearing problem, see the comments in the demo link above.

The codes you shown work fine on my end, but from your code I suspect .menu ul li ul { margin-top: 5px; } could be the cause of such behavior. Currently it's working only because the first-level li have a bottom padding that is larger than 5px.
If by any chance the li in your homepage header doesn't have a bottom padding, then the top margin in the 2nd level ul will cause a 5px space between the li and the ul sublist inside it. When you move your mouse from the li to the sub list the mouse passes through that 5px space zone which doesn't belong to the list item and :hover loses its effect.
I would suggest changing that to .menu ul li ul { padding-top: 5px; }

Related

Subnav impossible to hover because of CSS style

I have to add a subnav in an existing nav using a CSS style to reach php page.
Existing nav was : nav > ul > li > a href (ok)
I did:
nav > ul > li > a href (ok)
nav > ul > li > ul > li > a href (ko)
I actually can't hover href (ko) with the cursor : items subnav disappear !
I search in CSS style but I don't really understand how it's works.
I want to click on the 2 pages linked in subnav bellow :
accountCustomerAll.php and serviceViewAll.php.
If you have an idea...
Here is my HTML code :
/* Nav Meu Styling */
.nav-menu li a {
padding: 0px;
text-decoration: none;
display: inline-block;
color: #222222;
font-weight: 500;
font-size: 12px;
text-transform: uppercase;
outline: none;
-webkit-transition: all 0.3s ease 0s;
-moz-transition: all 0.3s ease 0s;
-o-transition: all 0.3s ease 0s;
transition: all 0.3s ease 0s; }
.nav-menu li a.active, .nav-menu li a:hover {
color: #0093df !important; }
.nav-menu li:hover > a {
color: #000; }
.nav-menu > li {
margin-left: 30px; }
.nav-menu ul {
margin: 28px 0 0 0;
padding: 10px;
box-shadow: 0px 0px 30px rgba(127, 137, 161, 0.25);
background: #fff; }
.nav-menu ul li {
transition: 0.3s; }
.nav-menu ul li a {
padding: 5px 10px;
color: #333;
transition: 0.3s;
display: block;
font-size: 12px;
text-transform: none; }
.nav-menu ul li:hover > a {
color: #0093df; }
.nav-menu ul ul {
margin-right: 10px;
margin-top: 0; }
<nav id="nav-menu-container">
<ul class="nav-menu">
<li><a>Gérer l'Aérodrome</a>
<ul>
<li>Consulter les clients</li>
<li>Consulter les commandes</li>
</ul>
</li>
</ul>
</nav>
This could be helpful for you. You have to apply different css on inner <ul>.
/* /* Nav Meu Styling */
.nav-menu li {
float: left;
list-style: none; }
.nav-menu li a {
padding: 0px;
text-decoration: none;
display: inline-block;
color: #222222;
font-weight: 500;
font-size: 12px;
text-transform: uppercase;
outline: none;
-webkit-transition: all 0.3s ease 0s;
-moz-transition: all 0.3s ease 0s;
-o-transition: all 0.3s ease 0s;
transition: all 0.3s ease 0s;
}
.nav-menu li a.active,
.nav-menu li a:hover {
color: #0093df !important;
}
.nav-menu li:hover>a {
color: #000;
}
.nav-menu>ul {
padding: 10px;
box-shadow: 0px 0px 30px rgba(127, 137, 161, 0.25);
background: #fff;
}
.nav-menu ul li {
transition: 0.3s;
transition: 0.3s;
width: 75%;
}
.nav-menu ul li a {
padding: 5px 10px;
color: #333;
transition: 0.3s;
display: block;
font-size: 12px;
text-transform: none;
}
.nav-menu ul li:hover>a {
color: #0093df;
}
.nav-menu ul ul {
margin-right: 10px;
margin-top: 0;
}
.sub-menu {
display: none;
}
.sub-menu>li {
list-style: none;
float: left;
}
ul.nav-menu li a:hover+ul.sub-menu {
display: block;
}
ul.sub-menu:hover {
display: block;
}
<nav id="nav-menu-container">
<ul class="nav-menu">
<li><a>Gérer l'Aérodrome</a>
<ul class="sub-menu">
<li>Consulter les clients</li>
<li>Consulter les commandes</li>
</ul>
</li>
</ul>
</nav>
.nav-menu li a.active, .nav-menu li a:hover{ color: #0093df !important;}
Buggy :active, should be:
.nav-menu li a:active, .nav-menu li a:hover{ color: #0093df}
Please, don't use !importand, debug instead.
Nested structures are hard to maintain, easier would be
<ul><li> <ol><li> ... </li></ol></li></ul>
it is absolutely allowed to style <ol> without numbers.

An img that moves when shouldn't

So I have made a little website and I have found a problem. I have a two ul tags in a nav where I have put a couple of li tags in and then some ul tags in some of those li tags I have also put an img in one of those li tags in another li. When I then apply some animations the img moves along with the other tabs... Here are some pictures;
When nothing is touched with the mouse. Everything looks fine
When I'm hovering over the lock (the img I was walking about) it is moving to the right and showing a logout button
But when I'm dragging this down the lock img is following down.
Here too
And here is the code of the whole nav bar:
body{
margin-left: 10px;
padding: 10px;
font-family: arial;
background-color: #E9EBEE !important;
}
nav {
margin-top: -10px;
height: 80px;
background-color: #2A3943;
padding: 5px;
box-shadow: 2.5px 2.5px 2.5px #888888;
border-radius: 4px;
z-index: 1;
}
nav h1 {
color: white;
margin-left: 20px;
}
nav ul {
margin-left: 27%;
list-style: none;
margin-top: -55px;
}
nav ul li {
border-radius: 2px;
float: left;
cursor: pointer;
margin-left: 5px;
display: inline;
padding: 21.5px;
background-color: #1AB188;
transition: all .5s ease;
box-shadow: 2.5px 2.5px 2.5px #0d1215;
}
nav ul li:hover {
box-shadow: 5px 5px 5px #0d1215;
}
nav ul li#pleb {
height: 19px;
}
nav ul li#pleb ul {
margin-top: -80px;
opacity: 0;
transition: all .5s ease;
}
nav ul li#pleb:hover ul {
opacity: 1;
margin-top: 30px;
}
nav ul li#pleb:hover {
height: 290px;
}
nav ul li:hover {
background-color: #179E79;
}
nav ul li ul.dropdwn li {
display: none;
margin-top: 20px;
margin-left: -90px;
}
nav ul li:hover ul.dropdwn li {
display: block;
}
nav ul li ul li:hover {
background-color: #2A3943;
}
nav ul li a {
color: white;
text-decoration: none;
}
nav ul li#fort {
height: 19px;
}
nav ul li#fort:hover {
height: 400px;
}
nav ul li#fort ul {
margin-left: -50px;
margin-top: -300px;
opacity: 0;
transition: all .5s ease;
}
nav ul li#fort:hover ul {
margin-top: 20px;
opacity: 1;
}
nav ul li#fort ul.drpdown li {
display: none;
margin-top: 10px;
}
nav ul li#fort:hover ul.drpdown li {
display: block;
}
nav .login ul {
list-style: none;
margin-top: 0px;
border-color: none;
}
nav .login ul li {
background-color: rgba(38, 181, 150, 0);
box-shadow: none;
margin-top: -80px;
margin-left: 770px;
transition: all .5s ease;
}
nav .login ul li:hover {
transform: translateX(-100px);
}
nav .login ul li img {
width: 40px;
}
nav .login ul li img:hover {
transform: none;
}
nav .login ul li ul li {
display: none;
margin-left: -30px;
margin-top: -60px;
transition: none;
background-color: rgba(119, 221, 110, 0);
}
nav .login ul li ul li#signup {
position: absolute;
margin-left: 20px;
margin-top: -60px;
}
nav .login ul li ul li#logout {
margin-left: -10px;
}
nav .login ul li:hover ul li {
display: block;
transform: none;
}
nav .login ul li ul li button {
border: none;
padding: 5px;
cursor: pointer;
background-color: rgba(164, 19, 34, 0);
color: #fff;
transition: all .5s ease;
}
nav .login ul li ul li button:hover {
background-color: #1AB188;
padding: 10px;
}
nav .login ul li ul li#signup button {
width: 80px;
}
<nav>
<h1>MemeStagram</h1>
<ul>
<li>Home</li>
<li id="pleb">Memes
<ul class="dropdwn">
<li>Most Popular</li><br>
<li>Newest</li><br>
<li>Most Viewed</li>
</ul>
</li>
<li>About Us</li>
<li id="fort">Contact
<ul class="drpdown">
<li>Bebin</li><br>
<li>Balbin</li><br>
<li>Bohan</li><br>
<li>Barcus</li><br>
<li>Bonis</li>
</ul>
</li>
<li>Settings</li>
</ul>
<div class="login">
<ul>
<li><img src="img/unlock.png">
<ul>
<li id="logout">
<button type="submit">Logout</button>
</li>
</ul>
</li>
</ul>
</div>
</nav>
I Would be really thankful for help with this problem. And I have tried to set position: absolute; and position: fixed; but it didn't give me any positive result...
//Kevin
Please find below a complete rewrite of your code as it was all over the place and was not consistent with standards. Please read over the below code and look where you went wrong to learn more about css.
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
* {font-family: arial;}
header {background-color: #2A3943;padding: 10px 40px;box-shadow: 2.5px 2.5px 2.5px #888888;border-radius: 4px;}
header nav h1 {display: inline-block;color: white;}
header nav {display: block;}
header nav ul {list-style: none; padding: 0px;display: block;}
header nav ul li {position:relative;display: inline-block;border-radius: 2px;cursor: pointer;padding: 22px;background-color: #1AB188;box-shadow: 2.5px 2.5px 2.5px #0d1215;margin:0px 5px;text-align: center;}
header nav ul li:hover > ul {visibility: visible;transform: translateY(0%);transition-delay: 0s, 0s, 0.3s;opacity: 1}
header nav ul li > ul {background-color:#1AB188;top:60px;visibility: hidden;position: absolute;width: 100%;transform: translateY(-2em);transition: all 0.3s ease-in-out 0s, visibility 0s linear 0.3s, z-index 0s linear 0.01s;left:0px;opacity: 0;}
header nav ul li a {text-decoration: none;color: white;display: block;}
header nav ul li a:hover {color: #333;}
header nav ul li:last-child {float: right;margin-right: 0px;padding: 20px 0px; background: none;box-shadow: none;}
header nav ul li:first-child {border-radius: none;padding: 0px;background-color:transparent;box-shadow: none;margin-right: 40px;}
header nav ul li:nth-child(2) {margin-left: 0px;}
header nav ul li:last-child > * {display: inline-block;vertical-align: middle;}
header nav ul li:last-child img {margin-right: 20px;width: 40px;}
header nav ul li:last-child:hover a button {visibility: visible;transform: translateX(0%);transition-delay: 0s, 0s, 0.3s;opacity: 1}
header nav ul li a button {padding: 5px;cursor: pointer;background-color: rgba(164, 19, 34, 0);color: #fff;visibility: hidden;transform: translateX(2em);transition: all 0.3s ease-in-out 0s, visibility 0s linear 0.3s;opacity: 0;}
header nav ul li > ul li {box-shadow: none;background: none;display: block;border-radius: 0px;margin:0px;padding: 21px !important}
header nav ul li > ul li:last-child {float: none;}
header nav ul li > ul li:first-child {margin: 0px;}
</style>
</head>
<body>
<div class="wrapper">
<header>
<nav>
<ul>
<li><h1>MemeStagram</h1></li>
<li>Home</li>
<li>Memes
<ul>
<li>Most Popular</li><br>
<li>Newest</li>
<li>Most Viewed</li>
</ul>
</li>
<li>About Us</li>
<li>Contact
<ul>
<li>Bebin</li>
<li>Balbin</li>
<li>Bohan</li>
<li>Barcus</li>
<li>Bonis</li>
</ul>
</li>
<li>Settings</li>
<li class="login"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f4/Simpleicons_Interface_unlocked-padlock.svg/1024px-Simpleicons_Interface_unlocked-padlock.svg.png" alt="Login/Logout"><button type="submit">Logout</button></li>
</ul>
</nav>
</header>
</div>
</body>
</html>
As you seem pretty new to css I will explain the of selectors used:
> This selector means "directly inside" so when I put li > ul it means target the UL directly inside an li
* this selector means everything, where I have set everything to have font-famly:arial.
:hover this selector means on hover of the element its attached to, do something
:last-child this selector means the last child of the attached element
:first-child this selector means the first child the attached element
Heres a working codepen: https://codepen.io/anon/pen/MrPBEW

HTML/CSS drop down menu (hover)

hi I am having trouble with my dropdown menu.
Here is the HTML code
<div class="sticky-nav">
<a id="mobile-nav" class="menu-nav" href="#menu-nav"></a>
<div id="logo">
<a id="goUp" href="index.html" title="CyberSprint"></a>
</div>
<nav id="menu">
<ul id="menu-nav">
<li>About Us</li>
<li>Solutions
<ul id="submenu-nav">
<li> Healthcare ITSolutions</li>
<li>Government IT Solutions</li>
</ul>
</li>
<li>Services
<ul id="submenu-nav">
<li>Risk Management</li>
<li>Audit & Assessment</li>
<li>Disaster Recovery & Business Continuity Planning</li>
</ul>
</li>
<li>Contact</li>
<li> Login</li>
</ul>
</nav>
</div>
and here is the CSS code
nav#menu {
float: left;
margin-left: 50px;
margin-top: 10px;
}
nav#menu #menu-nav {
margin: 0;
padding: 0;
}
nav#menu #menu-nav li {
list-style: none;
display: inline-block;
margin-left: 50px;
}
nav#menu #menu-nav li:first-child {
margin-left: 0;
}
nav#menu #menu-nav li a {
color: #FFFFFF;
font-size: 16px;
font-weight: 300;
line-height: 60px;
display: block;
text-transform: uppercase;
}
nav#menu #menu-nav li.current a,
nav#menu #menu-nav li a:hover {
color: #23aae1;
}
nav#menu #menu-nav li ul li {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
nav#menu #menu-nav li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
nav#menu #menu-nav li ul li {
background: #666;
}
Thank you
What is the problem that you are having?
You Shouldn't put identical ids in one document.
The sub-menus shouldn't be visible:
ul > li > ul {
display: none;
}
Maybe this is what you are looking for?
ul > li:hover > ul {
display: block;
}
This is a working example:
http://codepen.io/anon/pen/gpJrov
Again, you did not mention what the actual problem was here, but here are a few things I see wrong here...
1: even though you are not calling the ID's in your CSS, your HTML shows multiple elements with the same ID...you shouldn't do that.
2: you have
nav#menu #menu-nav li ul li { ... }
listed 3 times here.
- just add the third one with the first one...
- the second one is where you are having some of your problems.
for the your
nav#menu #menu-nav li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
block, you need to add :hover after the first li, else this isn't doing anything for you...
3: in your first
nav#menu #menu-nav li ul li { ... }
block, get rid of
visibility:hidden
and
opacity:0
they are not needed here...
after making these changes, I got your code to run just fine; though you will need to adjust the positioning of your nested lists...they are all the way to the left...
hope this helps.

Dropdown CSS issue - hidden list shows up when hovered over

my problem is that when I hover over the area where the hidden list is, it shows the hidden list. I only want it to show the hidden list when hovered over the 'Language' link on the dropdown menu. Why is it doing this, it's probably something blindingly obvious that I can't spot.
Cheers :)
EDIT: I've already tried using a fixed height for the #lang_bar. I also need the transitions to still work. I've already tried using the display:none and display:block; but that didn't work so I used visibility instead.
Any ideas?
HTML:
<div id="lang_bar">
<ul>
<li><strong>Language</strong>
<ul>
<li><strong>Maori</strong></li>
<li><strong>Tongan</strong></li>
<li><strong>Chinese</strong></li>
<li><strong>Japanese</strong></li>
<li><strong>Korean</strong></li>
</ul>
</ul>
</div>
#lang_bar {
font-family: 'Open Sans', sans-serif;
color: white;
padding-left: 152px;
text-transform: uppercase;
z-index: 40;
position: absolute;
padding-top: 2px;
top: 0;
}
#lang_bar ul ul li a {
padding-top: 3px;
padding-left:5px;
}
#lang_bar ul li ul li a:before {
content: '';
display:block;
right: 0px;
height: 2px;
bottom:117px;
width: 100px;
position: absolute;
background: rgba(255, 255, 255, 0.2);
}
#lang_bar ul li ul li a:after {
content: '';
display:block;
right: 1px;
height: 2px;
width: 100px;
position: absolute;
background: rgba(255, 255, 255, 0.6);
}
#lang_bar li, #lang_bar li ul {
text-decoration: none;
list-style-type: none;
}
#lang_bar ul {
list-style: none;
padding-left: 0px;
}
#lang_bar ul li {
float: left;
width: 100px;
text-align: left;
line-height: 21px;
}
#lang_bar ul li a {
display: block;
color: #FFF;
background: transparent;
text-decoration: none;
text-align: center;
}
#lang_bar ul li ul {
visibility: hidden;
font-size:12px;
opacity: 0;
}
#lang_bar ul li:hover ul {
opacity: 1;
visibility: visible; /* display the dropdown */
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}
#lang_bar ul li ul a:hover{
transition-duration: 0.6s;
background-color: rgba(255, 0, 0, 0.23);
}
I changed your css a little bit and here is the result
I used display:none and display: block in place of visibility, and everything is working as it should be.
http://jsfiddle.net/sy3qowxs/5/enter link description here
And here is your final CSS:
#lang_bar {
font-family: 'Open Sans', sans-serif;
color: #123111;
padding-left: 152px;
text-transform: uppercase;
z-index: 40;
position: absolute;
padding-top: 2px;
top: 0;
}
#lang_bar a:link{color:#333333;}
#lang_bar ul ul li a {
padding-top: 3px;
padding-left:5px;
}
#lang_bar ul li ul li a:before {
content: '';
display:block;
right: 0px;
height: 2px;
bottom:117px;
width: 100px;
position: absolute;
background: rgba(255, 255, 255, 0.2);
}
#lang_bar ul li ul li a:after {
content: '';
display:block;
right: 1px;
height: 2px;
width: 100px;
position: absolute;
background: rgba(255, 255, 255, 0.6);
}
#lang_bar li, #lang_bar li ul {
text-decoration: none;
list-style-type: none;
}
#lang_bar ul {
list-style: none;
padding-left: 0px;
}
#lang_bar ul li {
float: left;
width: 100px;
text-align: left;
line-height: 21px;
}
#lang_bar ul li a {
display: block;
color: #FFF;
background: transparent;
text-decoration: none;
text-align: center;
}
#lang_bar ul li ul {
display: none;
font-size:12px;
opacity: 0;
}
#lang_bar ul li:hover ul {
opacity: 1;
display: block; /* display the dropdown */
-webkit-transition: all .25s ease;
-moz-transition: all .25s ease;
-ms-transition: all .25s ease;
-o-transition: all .25s ease;
transition: all .25s ease;
}
#lang_bar ul li ul a:hover{
transition-duration: 0.6s;
background-color: rgba(255, 0, 0, 0.23);
}
As an alternative to the display: none solution, for accessibility reasons you can use position:absolute and then move the hidden element off screen:
ul li ul {
position:absolute;
top:-1000px;
}
ul li:hover ul {
top:auto;
}
It should work with visibility, since it hides the element (like display: none) but doesn't remove it from the DOM
Here is a working example: Dropdown Menu
HTML
<ul class="menu">
<li class="menu-item"> Dropdown Menu
<ul class="submenu">
<li class="submenu-item">Link</li>
<li class="submenu-item">Link</li>
<li class="submenu-item">Link</li>
<li class="submenu-item">Link</li>
<li class="submenu-item">Link</li>
</ul>
</li>
</ul>
CSS
.menu-item {
position: relative;
}
.menu-item:hover .submenu {
visibility: visible;
opacity: 1;
}
.submenu {
position: absolute;
visibility: hidden;
transition: all .2s ease;
opacity: 0;
top: 100%;
}
.submenu-item {
padding: .4em;
}
What about just using the adjacent sibling combinator:
Change: #lang_bar ul li:hover ul
To: #lang_bar ul li a:hover + ul
To add to the previous answer, the reason this works when you use the display property instead of visibility is because display removes the element from the document flow, and other elements reflow in its place. Visibility, on the other hand, hides the element, but leaves the empty space as if it were still there. So when you used visibility: hidden, your list item looked like it just contained the text "Language" and the link, but the hidden ul was still there, and still hoverable. That's why when you hovered over where the list item should have been, it reappeared; technically, you were hovering over that first list item, because the sub menu was a child of it.
In general, I use display:block/display:none to toggle hiding and showing of items, rather than visibility. Typically the use case is that you want the element completely hidden from the page, and elements around it to reflow, and the display property will do that for you.

CSS transition doesn't work in Firefox

I tried a lot and already searched in Google but I don't find a solution for my problem:
I made a jsfiddle for you to see my source-code: Click here for my Source Code
Everything works fine. But the transition doesn't work in Firefox.
Here is my Sourcecode because I have to post it too if I want to use a jsfiddle!
<nav>
<ul>
<li>Startseite</li>
<li>Projekte
<ul>
<li>Java / Bukkit</li>
<li>Webdesign</li>
<li>PHP | MySQL</li>
</ul>
</li>
<li>Kontakt</li>
<li>Über mich</li>
</ul>
<div class="clear"></div>
</nav>
// CSS down \\ HTML up
nav{
background: #333;
color: #fff;
padding: 5px;
}
nav ul{
padding: 0px;
margin: 0px;
list-style: none;
}
nav ul li{
float:left;
}
nav ul li a{
color: #fff;
background: #585858;
padding: 10px;
margin-right: 5px;
display: block;
text-decoration: none;
border: 1px solid white;
}
nav ul li a.active{
background: #373737;
}
nav ul li a:hover{
color: #333;
background: #fff;
border: 1px solid black;
}
nav ul li ul{
position: absolute;
height: 0px;
overflow: hidden;
}
nav ul li ul li{
float: none;
}
nav ul li:hover ul{
overflow: visible;
}
nav ul li:hover ul li a{
padding: 10px;
}
nav ul li ul li a{
-webkit-transition: 0.3s;
-moz-transition: 0.3s;
-ms-transition: 0.3s;
-o-transition: 0.3s;
transition: 0.3s;
padding: 0px 10px;
}
It looks like removing the overflow:hidden from the container suddenly makes the transition work. This leads me to believe it's an "optimisation" in Firefox that doesn't compute the "hidden" element.
Personally, I've used this to produce a similar effect: Rather than hiding the element, give it transform:scaleY(0); normally, and transform:scaleY(1); on hover.