CSS 3 Level Dropdown Menu - html

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.

Related

List hover not activating

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>

divs move around in IE

I've been working on a website and after testing it in all browsers it looks fine except in IE, the contact div and nav shift around the page. Can someone advise me of any code that can correct this?
http://jsfiddle.net/ykntfnnx/
Thanks in advance
Here is the HTML and CSS that have the issue in IE
<div id="menu">
<ul>
<li>Home</li>
<li class="divider"></li>
<li><span>About Us</span></li>
<li class="divider"></li>
<li><span><span>Work</span></span></li>
<li class="divider"></li>
<li><span><span><span>Services</span></span></span></li>
<li class="divider"></li>
<li><span><span><span><span>Contact</span></span></span></span></li>
</ul>
<div id="contact">
<h3>020 8810 5000<br />
07703 193 868 info#spema.co.uk</h3>
</div>
</div>
CSS
#menu{
float:right;
padding:50px 25px 0 50px;
margin:0px;
height:15px;
}
#menu ul{
display:block;
list-style:none;
margin:0px;
}
#menu ul li{
display:inline;
padding:0px;
margin:0px;
}
#menu ul li.divider{
float:left;
width:1px;
height:15px;
background:url(images/menu_divider.gif) no-repeat center;
padding:0 12px 0 12px;
}
#menu ul li a{
display:block;
padding:0px;
margin:0px;
float:left;
font-family: 'aleobold', Arial, sans-serif;
text-decoration:none;
color: #FC0;
font-size:18px;
line-height:12px;
}
#menu ul li a:hover{
color: #68696C;
font-family: 'aleobold', Arial, sans-serif;
}
#menu ul li a span {
display:block;
padding:0px;
margin:0px;
float:left;
font-family: 'aleobold', Arial, sans-serif;
text-decoration:none;
color: #F0F;
font-size:18px;
line-height:12px;
}
#menu ul li a span:hover{
color: #68696C;
font-family: 'aleobold', Arial, sans-serif;
}
#menu ul li a span span {
display:block;
padding:0px;
margin:0px;
float:left;
font-family: 'aleobold', Arial, sans-serif;
text-decoration:none;
color: #6CF;
font-size:18px;
line-height:12px;
}
#menu ul li a span span:hover{
color: #68696C;
font-family: 'aleobold', Arial, sans-serif;
}
#menu ul li a span span span{
display:block;
padding:0px;
margin:0px;
float:left;
font-family: 'aleobold', Arial, sans-serif;
text-decoration:none;
color: #6C6;
font-size:18px;
line-height:12px;
}
#menu ul li a span span span:hover{
color: #68696C;
font-family: 'aleobold', Arial, sans-serif;
}
#menu ul li a span span span span {
display:block;
padding:0px;
margin-left:0px;
float:left;
font-family: 'aleobold', Arial, sans-serif;
text-decoration:none;
color: #039;
font-size:18px;
line-height:12px;
}
#menu ul li a span span span span:hover{
color: #68696C;
font-family: 'aleobold', Arial, sans-serif;
}
#contact{
float:right;
height: 150px;
width: 225px;
}
body
{
background:url(images/triangle_background.jpg) repeat;
background-size: cover;
background-attachment:fixed;
font-family: 'aleoregular', Arial, sans-serif;
padding:0;
font-size:16px;
margin:0px auto auto auto;
color:#68696C;
}
h3{
color:#F7911D;
font-size:23px;
font-family: 'aleobold', Arial, sans-serif;
text-align: right;
clear:both;
}
Try adding a width to your #menu declaration
#menu{
float:right;
padding:50px 25px 0 50px;
margin:0px;
height:15px;
width:440px;
}
http://jsfiddle.net/ykntfnnx/2/
IE seems to act a bit funny with floats unless a width of the div is supplied

Dropdown menu working differently in Firefox

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/

CSS Styles are not available on Firefox/IE

I designed a website using Dreamviewer. The styles I applied to the webpage are not available on Firefox and IE, webpage is displayed in plain HTML format. But all styles are well displayed in Chrome.What is the reason for that and how can fix that problem?
This is my stylesheet
* { padding:0; margin:0; border:0; }
p { font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#202020; line-height:180%;}
h1, h2, h3, h4 { color:#00486A; font-family:Arial, Helvetica, sans-serif;}
h1 { padding: 5px 5px 10px 0; font-size:24px;}
#wrapper { margin:5px auto; width:1000px; background-color:#E6E6FF;} /*opacity:0.8; filter:alpha(opacity=80)}*/
body { background:url(../img/backgrounds/sparkling_design-HD.jpg); background-repeat:repeat; }
#logo { float:left; margin:10px 5px 10px 20px; opacity:1; ;}
#logo img { opacity:1;}
#loginform { float:right; padding: 20px 30px 10px 10px; margin: 10px 10px; }
#loginform a { float:right; clear:both; }
#loginform a:link { font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#666; text-decoration:none; }
#loginform a:visited { font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#666; text-decoration:none; }
#loginform a:active { font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#666; text-decoration:none; }
#loginform a:hover { font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#999; text-decoration:none; text-decoration:underline;}
#loginform a:focus { font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#666; text-decoration:none; }
#loginform label { float:left; width:70px; line-height: 100%; font-family:Arial, Helvetica, sans-serif; color:#666; font-size:12px; padding-top:5px;}
#loginform input { -webkit-border-radius:5px; border-radius:5px; width:150px; line-height:180%; height:20px; margin-bottom:10px; padding-right:5px; border:1px solid #999; padding-left: 8px;}
#loginform input[type=submit] { float:right; text-align:center; width:75px; background-color:#82BDFF; font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#333333; padding-left:8px; border: 1px #999999 solid; line-height:10px;}
#loginform input[type=submit]:hover { background-color:#0060FF; color:#FFF; }
#topnav { clear:both; padding:10px 5px 10px 5px; margin:5px 5px 5px 20px; border-top:1px #B7B1FE solid; border-bottom:1px #B7B1FE solid;}
#topnav ul li { display:inline; list-style-type:none; padding-left:20px; }
#topnav ul li a:link { font-family:'Noto Serif',Arial, Helvetica, sans-serif; font-size:14px; text-decoration:none; color:#00324A; font-weight:bold; }
#topnav ul li a:active { font-family:'Noto Serif',Arial, Helvetica, sans-serif; font-size:14px; text-decoration:none; color:#00324A; font-weight:bold; }
#topnav ul li a:visited { font-family:'Noto Serif',Arial, Helvetica, sans-serif; font-size:14px; text-decoration:none; color:#00324A; font-weight:bold; }
#topnav ul li a:hover { font-family:'Noto Serif',Arial, Helvetica, sans-serif; font-size:14px; text-decoration:none; color:#7C96FC; font-weight:bold; }
#topnav ul li a:focus { font-family:'Noto Serif',Arial, Helvetica, sans-serif; font-size:14px; text-decoration:none; color:#00324A; font-weight:bold; }
#banner { clear:both; margin:5px 20px; width:960px;}
#banner img { padding: 10px 0 10px 15px; }
#content { float:left; width:700px; padding:10px 20px 10px 10px; margin:5px 5px 10px 10px; text-align:justify;}
#rightpane { float:right; width:220px; font-family:Arial, Helvetica, sans-serif; font-size:12px; line-height:180%; color:#202020; margin-right: 20px; background-color:#D9DDFF; margin-bottom:20px; border:1px #0080C0 solid; border-radius:5px;}
#searchbox { padding:10px 5px 10px 20px; margin-top:5px; }
#search input[type=text] { border-radius:5px; -webkit-border-radius:5px; height: 20px; width:150px; border:1px #0080C0 solid; margin-right: 5px; }
#search input[type=submit] { border-radius:5px; -webkit-border-radius:5px; -moz-border-radius:5px; height:25px; width:30px; border:1px #0080C0 solid; background-color:#82BDFF; line-height:5px;}
#search input[type=submit]:hover { background-color:#0060FF; color:#FFF; }
#searchbox h3 { margin-left:0; }
/*---------------------Signup page------------ */
#form-content { border: 1px solid #666; float:left; width:690px; padding:10px 20px 10px 10px; margin:5px 15px 10px 20px; }
#form-add-account input[type=text], #form-add-account input[type=password] { width: 200px; height:20px; border-radius:5px; border: 1px #0080C0 solid;}
#form-add-account label { font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#666;}
#form-add-account table { padding-top: 5px; }
/*---------------------------------------------*/
#latest-posts { padding:10px 5px 10px 10px; margin:20px 0; }
#latest-posts ul { list-style-type:none; padding-right:5px; padding-left:10px; line-height: 180%;}
#latest-posts ul li a:link { text-decoration:none; color:#202020;}
#latest-posts ul li a:active { text-decoration:none; color:#202020;}
#latest-posts ul li a:visited { text-decoration:none; color:#202020;}
#latest-posts ul li a:hover { text-decoration:none; color:#7C96FC; text-decoration:blink;}
#latest-posts ul li a:focus { text-decoration:none; color:#202020;}
#recommendations { padding:10px 5px 10px 10px; margin:20px 0; }
#recommendations ul { list-style-type:none; padding-right:5px; padding-left:10px;}
#recommendations ul li a:link { text-decoration:none; color:#202020;}
#recommendations ul li a:active { text-decoration:none; color:#202020;}
#recommendations ul li a:visited { text-decoration:none; color:#202020;}
#recommendations ul li a:hover { text-decoration:none; color:#7C96FC; text-decoration:blink;}
#recommendations ul li a:focus { text-decoration:none; color:#202020;}
#footer { clear:both; width:980px; margin:10px auto; border-top:2px #CCCCCC dotted; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#666;}
#footer p { font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#666; }
#footer h4 { font-size:11px; padding-bottom:4px; }
#social-media { float:left; width:230px; margin:10px 0px 10px 30px;}
#social-media ul { list-style-type:none; line-height:180%;}
#social-media ul li a:link { text-decoration:none; color:#666;}
#social-media ul li a:active { text-decoration:none; color:#666;}
#social-media ul li a:visited { text-decoration:none; color:#666;}
#social-media ul li a:hover { text-decoration:none; color:#7C96FC; text-decoration:blink;}
#social-media ul li a:focus { text-decoration:none; color:#666;}
#contacts { float:left;width:230px; margin:10px 0px 10px 120px; }
#notice { width:230px; float:right; margin-top:10px; }
#footer-bottom { clear:both; text-align:center; padding:10px 10px 20px 10px; border-top:2px #CCCCCC dotted; }
I don't see any advanced or complex CSS code, so all modern browsers should support it. Anyway, here is a checklist:
Checklist
Did you checked different browser versions (you can switch inside Internet Explorer between older versions)? Check: http://msdn.microsoft.com/en-us/library/gg699485(v=vs.85).aspx
Did you try a more simplified CSS?
Did you clean up your browser cache?
Did you try "Browser Sniffing"? Check: http://en.wikipedia.org/wiki/Browser_sniffing
Did you try it on another computer?
If you testing online you might want to check your .htaccess.

Adding subsubmenu to a horizontal menu

I am using a horizontal menu from cssmenumaker.com which features subitems. I've been trying, but I just don't manage to add subsub-items.
This is the CSS I'm using:
.menu{
border:none;
border:0px;
margin:0px;
padding:0px;
font: 67.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
font-size:14px;
font-weight:bold;
}
#menu {
position:absolute;
left:250px;
top:0px;
width:750px;
height:35px;
border:0px solid #123456;
}
.menu ul{
background:#000000;
height:35px;
list-style:none;
margin:0;
padding:0;
}
.menu li{
float:left;
padding:0px;
}
.menu li a{
background:#000000 url("images/seperator.gif") bottom right no-repeat;
color:#cccccc;
display:block;
font-weight:normal;
line-height:35px;
margin:0px;
padding:0px 25px;
text-align:center;
text-decoration:none;
}
.menu li a:hover,
.menu ul li:hover a{
background: #2580a2 url("images/hover.gif") bottom center no-repeat;
color:#FFFFFF;
text-decoration:none;
}
.menu li ul{
background:#333333;
display:none;
height:auto;
padding:0px;
margin:0px;
border:0px;
position:absolute;
width:125px;
z-index:200;
/*top:1em;
/*left:0;*/
}
.menu li:hover ul{
display:block;
}
.menu li li {
background:url('images/sub_sep.gif') bottom left no-repeat;
display:block;
float:none;
margin:0px;
padding:0px;
width:125px;
}
.menu li:hover li a{
background:none;
}
.menu li ul a{
display:block;
height:35px;
font-size:12px;
font-style:normal;
margin:0px;
padding:0px 10px 0px 15px;
text-align:left;
}
.menu li ul a:hover,
.menu li ul li:hover a{
background:#2580a2 url('images/hover_sub.gif') center left no-repeat;
border:0px;
color:#ffffff;
text-decoration:none;
}
.menu p{
clear:left;
}
I already added the subsubmenu's to the HTML (which, I believe, is done correctly):
<div id="menu" class="menu">
<ul>
<li><a href="#" >item1</a></li>
<li>item2</li>
<li>item3
<ul>
<li>subitem1</li>
<li>subitem2</li>
<li>subitem3
<ul>
<li>subsubitem1</li>
<li>subsubitem2</li>
</ul>
</li>
<li>subitem4</li>
<li>subitem5</li>
</ul>
</li>
<li>item4</li>
<li>item5</li>
</ul>
Here's the current situation: http://bit.ly/GRJkT5
As you can see, subsubitems 1 and 2 are displayed on top of subitems 4 and 5. How should I edit the CSS?
Thanks in advance!
Frank.
You should consider making use of the > combinator.
Example:
/* instead of... */
.menu li:hover ul{
display:block;
}
/* use... */
.menu li:hover > ul{
display:block;
}
This will ensure that only direct children of the hovered element will be affected by the style.
Use this combinator in the right places, and your problem should be solved.
Your third level submenu is not really getting positioned absolutely so its just appearing over your second level submenu. Properly position it relative to your submenu, use the child selector to display your second level submenu as Kolink suggested and it should work, like so:
CSS
.menu li:hover > ul{
display:block;
}
.menu li {
position:relative;
}
.menu ul ul ul {
position:absolute;
left:100%;
top:0;
}
Ok, small baby-steps here. I added coding for the subsubmenu's (I will condense the code later):
.menu{
border:none;
border:0px;
margin:0px;
padding:0px;
font: 67.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
font-size:14px;
font-weight:bold;
}
#menu {
position:absolute;
left:250px;
top:0px;
width:750px;
height:35px;
border:0px solid #123456;
}
.menu ul{
background:#000000;
height:35px;
list-style:none;
margin:0;
padding:0;
}
.menu li{
float:left;
padding:0px;
}
.menu li a{
background:#000000 url("images/seperator.gif") bottom right no-repeat;
color:#cccccc;
display:block;
font-weight:normal;
line-height:35px;
margin:0px;
padding:0px 25px;
text-align:center;
text-decoration:none;
}
.menu li a:hover, .menu ul li:hover a{
background: #2580a2 url("images/hover.gif") bottom center no-repeat;
color:#FFFFFF;
text-decoration:none;
}
/* --- START SUBMENU -------------------------------------------------------------- */
.menu li ul{
background:#333333;
display:none;
height:auto;
padding:0px;
margin:0px;
border:0px;
position:absolute;
width:225px;
z-index:200;
/*top:0px;*/
/*left:0px;*/
}
.menu li:hover ul{
display:block;
}
.menu li li {
background:url('images/sub_sep.gif') bottom left no-repeat;
display:block;
float:none;
margin:0px;
padding:0px;
width:225px;
}
.menu li:hover li a{
background:none;
}
.menu li ul a{
display:block;
height:35px;
font-size:12px;
font-style:normal;
margin:0px;
padding:0px 10px 0px 15px;
text-align:left;
}
.menu li ul a:hover, .menu li ul li:hover a{
background:#2580a2 url('images/hover_sub.gif') center left no-repeat;
border:0px;
color:#ffffff;
text-decoration:none;
}
.menu p{
clear:left;
}
/* --- START SUBSUBMENU -------------------------------------------------------------- */
.menu li ul li ul{
background:#333333;
display:none;
height:auto;
padding:0px;
margin:0px;
border:0px;
position:absolute;
width:225px;
z-index:200;
/*top:0px;*/
/*left:0px;*/
}
.menu lu ul li:hover ul{
display:block;
}
.menu li li li {
background:url('images/sub_sep.gif') bottom left no-repeat;
display:block;
float:none;
margin:0px;
padding:0px;
width:225px;
}
.menu li:hover li li a{
background:none;
}
.menu li ul li ul a{
display:block;
height:35px;
font-size:12px;
font-style:normal;
margin:0px;
padding:0px 10px 0px 15px;
text-align:left;
}
.menu li ul li ul a:hover, .menu li ul li ul li:hover a{
background:#2580a2 url('images/hover_sub.gif') center left no-repeat;
border:0px;
color:#ffffff;
text-decoration:none;
}
The result is here: http://bit.ly/Hl9SwM
The subsubmenu's (2.4.1 etc.) are displayed directly when hovering over menu 2, and their location is not correct (should be to the right of submenu 2.4). How can I change that?
Thank you!