Nested Horizontal CSS Menus - css

I'm having a hard time with nested horizontal hovers. I either can't get the nested submenu hidden or I can't get it to show on hover. I've added the following to get the first sub menu hidden:
enter code here
.menu-holder ul li ul li ul li{
display:none;
}
and the following to try and get it to display:
enter code here
.menu-holder > ul > li > ul > li:hover > ul{
display: inline;
}
While the hiding is working the displaying is not. I'm not sure that this is how I should initially hide the submenu anyway.
One thing I haven't addressed yet is to get the menus to fill the screen to the left before they fill to the right.
.wrapper {
width:500px;
height:500px;
color:black;
}
.menu-holder ul {
margin: 2px 0 0px 25px;
padding: 0;
list-style-type: none;
}
.menu-holder ul li {
position: relative;
float: left;
padding: 0px 10px 0 10px;
margin: 0px 0px 100px 0px;
border-left: 1px dotted white;
}
.menu-holder ul li:hover{
background-color: green;
}
.menu-holder ul li:hover ul {
display: block;
}
.menu-holder ul li ul:hover {
display: block;
}
.menu-holder ul li.current-menu-item
{
background:#999
}
.menu-holder ul li ul li ul li{
display:none;
}
.menu-holder > ul > li > ul > li:hover > ul{
display: inline;
}
.menu-holder ul li a {
font-family: arial, sans-serif;
font-size: 12px;
font-weight: bold;
display: block;
color:black;
text-decoration: none;
padding: 15px 10px 15px 10px;
-webkit-border-radius: 5px 5px 0px 0px;
border-radius: 5px 5px 0px 0px;
}
.menu-holder ul li ul {
float: none;
display: none;
position: absolute;
top: 42px;
left: 0px;
margin: -1px 0 0px 10px;
padding: 5px 10px 5px 10px;
white-space: nowrap;
}
.menu-holder ul li ul li {
position: static;
float: none;
display: inline;
padding: 5px 10px 5px 10px;
margin: 0px 0px 0px -10px;
background-color: #025179;
}
.menu-holder ul li ul li a {
display: inline;
margin: 0 0px 0 0px;
padding: 0px 10px 0px 10px;
font-weight: normal;
-webkit-border-radius: 0;
border-radius: 0;
}
.menu-holder ul li ul li:first-of-type {
-webkit-border-radius: 0px 0px 0px 5px;
border-radius: 0px 0px 0px 5px;
}
.menu-holder ul li ul li:last-of-type {
-webkit-border-radius: 0px 5px 5px 0px;
border-radius: 0px 5px 5px 0px;
}
.menu-holder ul li:first-of-type {
border-left: none;
}
<div class="wrapper">
<div class="menu-holder">
<ul class="menu">
<li>item 1
</li>
<li>
<a id="close0" href="#" onclick="showiframe(this.id); return false;">
Follow This</a>
<ul class="submenu">
<li><a id="about" href="" onclick="showiframe(this.id); return false;">About</a>
</li>
<li>Item1</li>
<li>Item2</li>
<li>Follow This
<ul class="submenu">
<li>Item1
</li>
<li>Item2</li>
<li>Item3</li>
<li>follow This
<ul class="submenu">
<li>Item1
</li>
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
</ul>
</li>
</ul>
</li>
<li>Submenu item 2
</li>
</ul>
</li>
<li>menu item 3
</li>
<li>menu item 4
</li>
</ul>
</div>
<!-- menu-holder end -->
</div>
​

Not quite sure if this is the effect you are looking for.
.wrapper {
width:500px;
height:500px;
color:black;
}
.menu-holder ul {
margin: 2px 0 0px 25px;
padding: 0;
list-style-type: none;
}
.menu-holder ul li {
position: relative;
float: left;
padding: 0px 10px 0 10px;
margin: 0px 0px 100px 0px;
border-left: 1px dotted white;
}
.menu-holder ul li:hover{
background-color: green;
}
.menu-holder ul li:hover > ul {
display: block;
}
.menu-holder ul li.current-menu-item
{
background:#999
}
.menu-holder ul li a {
font-family: arial, sans-serif;
font-size: 12px;
font-weight: bold;
display: block;
color:black;
text-decoration: none;
padding: 15px 10px 15px 10px;
-webkit-border-radius: 5px 5px 0px 0px;
border-radius: 5px 5px 0px 0px;
}
.menu-holder ul li ul {
float: none;
display: none;
position: absolute;
top: 100%;
left: 0px;
margin: -1px 0 0px 10px;
padding: 5px 10px 5px 10px;
white-space: nowrap;
}
.menu-holder ul li ul li {
position: static;
float: none;
display: inline;
padding: 5px 10px 5px 10px;
margin: 0px 0px 0px -10px;
background-color: #025179;
}
.menu-holder ul li ul li a {
display: inline;
margin: 0 0px 0 0px;
padding: 0px 10px 0px 10px;
font-weight: normal;
-webkit-border-radius: 0;
border-radius: 0;
}
.menu-holder ul li ul li:first-of-type {
-webkit-border-radius: 0px 0px 0px 5px;
border-radius: 0px 0px 0px 5px;
}
.menu-holder ul li ul li:last-of-type {
-webkit-border-radius: 0px 5px 5px 0px;
border-radius: 0px 5px 5px 0px;
}
.menu-holder ul li:first-of-type {
border-left: none;
}
<div class="wrapper">
<div class="menu-holder">
<ul class="menu">
<li>item 1
</li>
<li>
<a id="close0" href="#" onclick="showiframe(this.id); return false;">
Follow This</a>
<ul class="submenu">
<li><a id="about" href="" onclick="showiframe(this.id); return false;">About</a>
</li>
<li>Item1</li>
<li>Item2</li>
<li>Follow This
<ul class="submenu">
<li>Item1
</li>
<li>Item2</li>
<li>Item3</li>
<li>follow This
<ul class="submenu">
<li>Item1
</li>
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
</ul>
</li>
</ul>
</li>
<li>Submenu item 2
</li>
</ul>
</li>
<li>menu item 3
</li>
<li>menu item 4
</li>
</ul>
</div>
<!-- menu-holder end -->
</div>
​

Here is a semantically correct implementation of what you are looking for:
HTML
<nav>
<div class="container">
<ul class="primary">
<li class="active">Item</li>
<li class="">Item</li>
<li class="">Item
<div class="secondary-nav-container">
<ul class="secondary">
<li class="">Sub Item 1</li>
<li class="">Sub Item 2</li>
<li class="">Sub Item 3</li>
</ul>
</div>
</li>
<li class="">Item 4</li>
</ul>
</div>
</nav>
CSS
nav .primary-navigation {
float: right;
margin: 0px;
}
nav .primary-navigation li {
float: left;
margin: 0px;
padding: 0px;
}
nav .primary-navigation li:last-child {
margin-right: 10px;
}
nav .primary-navigation a {
display: inline-block;
width: 100%;
padding: 0px 10px;
text-decoration: none;
font-size: 1.2em;
line-height: 2.2em;
}
nav.mobile .secondary-navigation a {
font-size: 1em;
line-height: 2.3em;
}
nav .secondary-nav-container {
position: absolute;
top: 36px;
left: 0px;
width: 100%;
min-height: 36px;
display: none;
}
nav .primary-navigation > li.active .secondary-nav-container,
nav .primary-navigation > li:hover .secondary-nav-container {
display: block;
z-index: 4;
}
nav .primary-navigation > li:hover .secondary-nav-container,
nav.mobile .primary-navigation > li:hover .secondary-nav-container{
z-index: 5;
}
nav .secondary-navigation, nav.mobile .secondary-navigation {
float: right;
}
Context:
I devised this HTML/CSS only solution for a CMS I developed a few years ago.
Show/Hide effects:
These can be done using css transitions or using javascript.

Related

How do I fix my code so that the dropdown menu aligns with the navigation bar (parent)?

I'm trying to align the dropdown menu when I hover over get started, but it doesn't work.
I tried adding the code left:auto; right:0; margin-right:-10px; to my CSS (as you'll see below) but it did nothing.
How do I fix this or add another code to make my menu aligned?
Is there a certain CSS trick to solve this?
nav ul {
background: url(transparent.png);
width: 100%;
height: 52px;
text-align: center;
padding: 0;
margin: 0;
}
nav ul li {
display: inline;
}
nav ul li a {
text-decoration: none;
color: #fff;
letter-spacing: 0.2em;
font: normal 100% arial, sans-serif;
text-align: center;
display: inline-block;
margin: 10px 0 0 10px;
padding: 9px 26px 9px 26px;
text-transform: uppercase;
}
nav ul li a:hover {
color: #000;
background-color: #fff;
}
.dropdown {
display: inline-block;
}
.dropdown-content {
background: #f9f9f9;
min-width: 160px;
position: absolute;
display: none;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background: #bada55;
left: auto;
right: 0;
margin-right: -10px;
}
.dropdown:hover .dropdown-content {
display: block;
}
<header>
<h1>Model United Nations Conference</h1>
<img src="dove.png" alt="a simple dove logo">
<nav>
<ul>
<li>Home</li>
<li class="dropdown"><a id="start" href="#">Get started</a>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li>Gallery</li>
<li>Contact Us</li>
<li>Forum</li>
</ul>
</nav>
</header>
You should go with this:
left: 50%;
transform: translateX(-50%);
also, take a look at my comments in your CSS
nav ul {
background: transparent;
width: 100%;
height: 52px;
text-align: center;
padding: 0;
margin: 0;
}
nav ul li {
display: inline;
}
nav ul li a {
text-decoration: none;
color: #DDD;
letter-spacing: 0.2em;
font: normal 100% arial, sans-serif;
text-align: center;
display: inline-block;
/*
margin: 10px 0 0 10px;
Use Equal margins: */
margin: 5px;
padding: 9px 26px 9px 26px;
text-transform: uppercase;
}
nav ul li a:hover {
color: #000;
background-color: #fff;
}
.dropdown {
display: inline-block;
/* important: */
position: relative;
}
.dropdown-content {
background: #f9f9f9;
min-width: 160px;
position: absolute;
display: none;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
/* Position */
left: 50%;
transform: translateX(-50%);
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background: #bada55;
}
.dropdown:hover .dropdown-content {
display: block;
}
<header>
<h1>Model United Nations Conference</h1>
<img src="dove.png" alt="a simple dove logo">
<nav>
<ul>
<li>Home</li>
<li class="dropdown"><a id="start" href="#">Get started</a>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li>Gallery</li>
<li>Contact Us</li>
<li>Forum</li>
</ul>
</nav>
</header>
For nav ul li a
I set this margin: 10px 0 0 0px;
This would align the "Get Started" header with the drop down values Aligned Dropdown Img
Is this how you wanted ?
nav ul {
background: url(transparent.png);
width: 100%;
height: 52px;
text-align: center;
padding: 0;
margin: 0;
}
nav ul li {
display: inline;
position:relative
}
nav ul li >a {margin: 10px 0 0 10px;}
nav ul li a {
text-decoration: none;
color: #000;
letter-spacing: 0.2em;
font: normal 100% arial, sans-serif;
text-align: center;
display: inline-block;
padding: 9px 26px 9px 26px;
text-transform: uppercase;
}
nav ul li:hover a{
color: #000;
background-color: #fff;
}
.dropdown {
display: inline-block;
}
.dropdown-content {
background: #f9f9f9;
min-width: 160px;
position: absolute;
display: none;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
left: 10px;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background: #bada55;
left: auto;
right: 0;
}
.dropdown:hover .dropdown-content {
display: block;
}
<header>
<h1>Model United Nations Conference</h1>
<img src="dove.png" alt="a simple dove logo">
<nav>
<ul>
<li>Home</li>
<li class="dropdown"><a id="start" href="#">Get started</a>
<div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
<li>Gallery</li>
<li>Contact Us</li>
<li>Forum</li>
</ul>
</nav>
</header>

Adding sub-menu to vertical menu CSS

This should be vertical menu with 2nd level sub menu as you can see 2 2.1 2.2
I tried many tutorials but just couldn't make it work i know lot of code for sub-menu is missing but honestly i have no idea what to do with it to fix it .
.menu ul li a {
margin: 2px;
padding: 2px;
font-family: comic sans ms;
border-bottom: 1px solid #ccc;
height: 25px;
width: 160px;
-moz-border-radius: 1em 4em 1em 4em;
border-radius: 1em 4em 1em 4em;
border-color: red;
cursor: pointer;
cursor: url(link.cur), auto;
text-decoration: none;
color: white;
padding: 9px 11px;
background-color: grey;
display: block;
}
.menu ul li a:visited {
color: white;
}
.menu ul li a:hover,
.menu_simple ul li .current {
color: white;
background-color: #0099CC;
/* green #5FD367 */
}
.menu ul li ul {
position: absolute;
display: none;
}
.menu ul li:hover ul {
left: 150px;
top: 0px;
display: block;
}
.menu ul li ul li a {
color: #454444;
display: inline-block;
width: 120px;
}
<div class="menu">
<ul>
<li>1
</li>
<li>2
<ul>
<li>2.1
</li>
<li>2.2
</li>
</ul>
<li>3
</li>
<li>4
</li>
</ul>
</div>
Here you go.. why did you use absolute to .menu ul li ul this code was causing problem !!
.menu ul li a {
margin: 2px;
padding: 2px;
font-family: comic sans ms;
border-bottom: 1px solid #ccc;
height: 25px;
width: 160px;
-moz-border-radius: 1em 4em 1em 4em;
border-radius: 1em 4em 1em 4em;
border-color: red;
cursor: pointer;
cursor: url(link.cur), auto;
text-decoration: none;
color: white;
padding: 9px 11px;
background-color: grey;
display: block;
}
.menu ul li a:visited {
color: white;
}
.menu ul li a:hover,
.menu_simple ul li .current {
color: white;
background-color: #0099CC;
/* green #5FD367 */
}
.menu ul li ul {
display: none;
}
.menu ul li:hover ul {
left: 150px;
top: 0px;
display: block;
}
.menu ul li ul li a {
color: #454444;
display: inline-block;
width: 120px;
}
<div class="menu">
<ul>
<li>1
</li>
<li>2
<ul>
<li>2.1
</li>
<li>2.2
</li>
</ul>
<li>3
</li>
<li>4
</li>
</ul>
</div>

CSS dropdown menu is 1 column on FF but 4 columns on Chrome etc

Need to know what's going on with my navigation. I'll post a screenshot. I have a drop down list using CSS and it displays fine on Chrome with 4 columns but on FireFox it is shown with 1 big long column. Help?
.nav{ background:#eaeadf; border-top:#eeeee5 solid 1px; margin:0px; box-shadow:0px -5px 5px #E7E9DA inset;}
.nav ul{ text-align: right; }
.nav ul li{ display: inline-block; }
.nav ul li span { color:#7c7c7c; font-size:16px; line-height:27px;}
.nav ul li a{ color:#7c7c7c; font-size:16px; padding:0px 10px; line-height:27px; text-transform:capitalize; margin: 0; display: inline-block; font-family:"Gill Sans", GillSans, Trebuchet, Calibri, sans-serif; letter-spacing: 1px; }
.nav ul li a:hover { color: #960530; }
.nav ul li:after { content:" | " ; color: #7c7c7c; font-size: 16px; line-height: 27px; }
.nav ul li.active:after { content: ""; }
.nav ul li:last-child a { padding-right: 0; }
.nav ul li:last-child:after { content: "";}
.nav ul li.active {
margin-left: -11px;
padding: 0 0 0 10px;
background: url(images/nav-active-left.png) left top no-repeat;
}
.nav ul li.active a {
color: #fff; position: relative;
background: url(images/nav-active-right.png) right top no-repeat; padding: 0 18px 0 12px;
}
.nav ul li.active a:after { top: 100%; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none; }
.nav ul li.active a:after { border-top-color: #7a0427; border-width: 10px; left: 50%; margin-left: -10px; }
.nav ul li ul { background: #363838; text-align: center; }
.nav ul li.drop ul { display: none; }
/*.nav ul li.drop:hover ul, .nav ul li.drop ul:hover { display: block; }
*/
.extended-menu { background: #363838; padding: 20px; display: none;
-moz-box-shadow: inset 0 11px 10px -7px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: inset 0 11px 10px -7px rgba(0, 0, 0, 0.3);
box-shadow: inset 0 11px 10px -7px rgba(0, 0, 0, 0.3);
}
.extended-menu ul{ text-align: center; display: block; margin: 0 auto; max-width: 1130px; columns: 4; -webkit-columns: 4; column-rule: 2px inset #a9a9a9;
-webkit-column-rule: 2px inset #a9a9a9;
-moz-column-rule: 2px inset #a9a9a9;}
.extended-menu ul li { display: block; margin-bottom: 15px;}
.extended-menu ul li a { padding: 0 10px; margin: 0 10px; font-size:16px; color:#fff; line-height:1.1em !important;}
.extended-menu ul li a:hover { color: #960530; }
.extended-menu ul li:after{ content:" " ; color: #7c7c7c; font-size: 16px; line-height: 27px; }
.extended-menu ul li:last-child:after{ content:"" ; }
<div class="nav">
<div class="wrapper">
<ul>
<li class="drop">Future Students
<ul>
<li>About CU</li>
<li>Academics</li>
<li>Admissions</li>
<li>Apply Now</li>
<li>Athletics</li>
<li>CU Connect</li>
<li>Directory</li>
<li>Financial Services</li>
<li>Graduate Programs</li>
<li>Online & Professional Studies</li>
<li>Request Information</li>
<li>Student Development</li>
<li>Preview Day Registration</li>
<li>Student Right to Know</li>
</ul>
</li>
<li class="drop">Current Students
<ul>
<li>Academic Calendar</li>
<li>Business Office</li>
<li>Canvas Login</li>
<li>Career Services</li>
<li>Catalog, Forms, and Handbooks</li>
<li>Comment Form</li>
<li>CU Connect</li>
<li>Dean of Students</li>
<li>Dining Services</li>
<li>Directory</li>
<li>ePortal</li>
<li>Financial Services</li>
<li>Hire CU</li>
<li>Today # CU</li>
<li>Online & Professional Studies</li>
<li>Residence Life</li>
<li>Rudy Wellness Center</li>
<li>Community </li>
<li>Student Development</li>
<li>Student Policies</li>
<li>Vise Library</li>
<li>Student Email</li>
<li>Student Resources</li>
<li>Student Right to Know</li>
<li>Commencement 2015</li>
</ul>
</li>
<li class="drop">Faculty & Staff
<ul>
<li>Communications</li>
<li>Directory</li>
<li>Dining Services</li>
<li>ePortal</li>
<li>Faculty CAMS Login</li>
<li>Faculty & Staff Email</li>
<li>Intranet</li>
<li>IT Service Request</li>
<li>Rudy Wellness Center</li>
<li>Student Right to Know</li>
</ul>
</li>
<li class="drop">Alumni & Friends
<ul>
<li>Alumni & Friends</li>
<li>Alumni Benefits</li>
<li>Alumni Map</li>
<li>Alumni Update Form</li>
<li>CU Alumni Association</li>
<li>Downloads</li>
<li>Meet the Team</li>
<li>Newsletters</li>
<li>Social Networking</li>
<li>Upcoming Events</li>
<li>Request a Transcript</li>
<li>Sign Up For E-Newsletter</li>
</ul>
</li>
<li class="drop">THE NET.WORK™ Cumberland University Online
<ul>
<li>THE NET.WORK™ Cumberland University Online</li>
<li>Corporate Partners</li>
<li>Business Online</li>
<li>Criminal Justice Online</li>
<li>RN-BSN Online</li>
<li>MAE Online</li>
<li>MBA Online</li>
<li>FAQs</li>
</ul>
</li>
</ul>
<div class="cleer"></div>
</div>
<div class="extended-menu"></div>
<div class="cleer"></div>
</div>
Any help would be appreciated. Again- the code looks fine in Chrome but shows only 1 column in FireFox.

Different alignment of Top menu and submenu

Hi I am trying to keep my top navigation menu centered while left aligning the submenus that come out. What do i have to change in order to accomplish this? THanks!
<div id="container">
<ul id="nav">
<li>Home</li>
<li>Services <img src="images/tri2.gif">
<ul>
<li>Massages</li>
<li>Body Treatments</li>
<li>Facials & Waxing</li>
<li>Hair & Nails</li>
</ul>
</li>
<li>Packages <img src="images/tri2.gif">
<ul>
<li>Linky</li>
<li>Linky</li>
<li>Linky</li>
<li>Linky</li>
<li>Linky</li>
<li>Linky</li>
</ul>
</li>
<li>Specials</li>
<li>Contacts</li>
</ul>
</div>
Here is the CSS:
#container {
width: 740px;
margin: -16px auto;
padding: 0 0 0 0px;
font: 100% Helvetica, Arial sans-serif;
font-size:14px;
}
ul#nav {
line-height: 23px;
padding: 0;
}
ul#nav li {
float: left;
position: relative;
list-style: none;
background: #006666;
}
ul#nav li a {
width: 146px;
display: block;
border: 1px solid #000;
text-align: center;
text-decoration: none;
color: #fff;
}
ul#nav li:hover {background: #990000;}
ul#nav ul {
position: absolute;
padding: 0;
left: 0;
top: 23px;
visibility: hidden;
}
ul#nav li:hover ul {visibility: visible;}
ul#nav a:hover {color: yellow;}
http://jsfiddle.net/chuckie365/5LuCA/
what you need here is an additional CSS targeting that a elements:
ul#nav ul li a {
text-align:left;
}
Heres is the demo http://jsfiddle.net/5LuCA/10/

IE 8 menu drop down issue

The Menus don't drop down as they did in IE7.Can anyone help…please!?
You have to click on the title for it to show up, otherwise the menu is hidden.
CSS below:
#top_nav{ width: 810px; float: left; background: #DADADA; margin: 0; position: relative; z-index: 100; padding: 0;}
#top_nav ul {margin: 0 0 0 10px; padding: 0; list-style: none; float: left; width: 800px; height: 40px; }
#top_nav li {float: left; margin: 0; padding: 0; width: auto; font-weight: normal; cursor: pointer; white-space: nowrap; font-size: 100%; color: #000; line-height: 150%;}
#top_nav li a{text-decoration: none; color: #000; width: auto; display: block; padding: 8px 18px 7px 18px; line-height: 25px; text-align: center; font-weight: normal; }
#top_nav li ul {position: absolute; left: -999em; height: auto; width: 234px; w\idth: 224px; font-weight: normal; padding: 0px 0 0 0; margin: 0 0 0 0; border-bottom: 1px solid #aaa; }
#top_nav li li {padding: 0; background-color: #DADADA; font-size: 90%; line-height: 120%;}
#top_nav li li a{line-height: auto; text-align: left; width: 212px; w\idth: 202px; padding: 3px 10px; border-top: 1px solid #aaa; border-left: 1px solid #aaa; border-right: 1px solid #aaa; }
#top_nav li li a:hover{ background-color: #92D400; color: #fff;}
#top_nav li:hover ul ul, #top_nav li:hover ul ul ul, #top_nav li.sfhover ul ul, #top_nav li.sfhover ul ul ul {left: -999em;}
#top_nav li:hover ul, #top_nav li li:hover ul, #top_nav li li li:hover ul, #top_nav li.sfhover ul, #top_nav li li.sfhover ul, #top_nav li li li.sfhover ul { left: auto;}
#top_nav li:hover, #top_nav li.sfhover, #top_nav a.active{ background-color: #92D400; }
#sub_nav{ background: #002F5F; float: left; width: 810px; margin: 0; }
#sub_nav ul{ float: left; width: 790px; margin: 0 0 0 10px; padding: 0; list-style: none; }
#sub_nav li{ float: left; margin: 0; padding: 0; font-size: 90%; font-weight: bold; text-align: center; }
#sub_nav li a{ color: #fff; display: block; height: 105px; padding: 8px 30px 0 30px; text-decoration: none; }
#sub_nav li a:hover,
#sub_nav li a.active{ background-color: #DADADA; color: #002F5F; }
#section_nav{ float: left; margin: 1px 0 0px 0; width: 810px; background: #002F5F; }
#section_nav ul{ float: left; width: 808px; margin: 0; padding: 0; list-style: none; }
#section_nav li{ float: left; margin: 0; padding: 0; font-size: 70%; font-weight: bold; }
#section_nav li a{ color: #fff; display: block; padding: 8px 10px; border-right: 1px solid #fff; border-bottom: 1px solid #fff; text-decoration: none; }
#section_nav li a:hover,
#section_nav li a.active{ background: #92D400;}
#section_nav img{ float: left; margin: 2px 0 0 2px;}
The dropdowns don't work automatically in IE8 and you also have to click on the title for it to show up.
HTML as listed below:
<link href="css/stylesheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery.min.1.7.1.js"></script>
<link rel="stylesheet" href="js/nivo-slider/nivo-slider.css" type="text/css" media="screen" />
<script src="js/nivo-slider/jquery.nivo.slider.pack.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(window).load(function() {
var total = jQuery('#slider img').length;
var rand = Math.floor(Math.random()*total);
jQuery('#slider').nivoSlider({
animSpeed: 1000, // Slide transition speed
pauseTime: 4000, // How long each slide will show
directionNav: false,
effect: 'boxRainGrow'
});
});
</script>
<script type="text/javascript">
$(function(){
$('a[href*=#]').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname) {
var $target = $(this.hash);
$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
if ($target.length) {
var targetOffset = $target.offset().top;
$('html,body').animate({scrollTop: targetOffset}, 500);
return false;
}
}
});
});
</script>
</head>
<body>
<a name="top"></a>
<div id="wrap"><!-- START OF WRAP -->
<div id="header"><!-- START OF HEADER -->
<img src="images/buttons/btn_back_to_hub.png" width="117" height="27" border="0">
<img src="images/txt/txt_global_energy_transformation.png" width="361" height="43" id="logo">
<br clear="all">
<div id="slider" class="nivoSlider">
<img src="images/headers/New-org-chart.png" width="730" height="162">
<img src="images/headers/New-appointments.png " width="730" height="162"></div>
</div><!-- END OF HEADER -->
<div id="top_nav"><!-- START OF TOP NAVIGATION -->
<ul>
<li>Home</li>
<li>GET Information
<ul>
<li>Latest news</li>
<li>Appointments &amp vacancies</li>
<!-- <li>Blogs</li> -->
<li>Change champions & SMEs</li>
<li>Stakeholders</li>
</ul>
</li>
<li>GET Involved</li>
<li>GET Answers
<ul>
<li>General</li>
<li>Service line-specific
</ul>
</li>
<li>GET in touch</li>
<li>Service lines/functions
<ul>
<li>Inspection services</li>
<li>Compliance services</li>
<li>Asset integrity services</li>
<li>Drilling integrity services</li>
<li>Consultancy services</li>
<li>Business development services</li>
<li>Business services</li>
<li>Finance</li>
<li>Human resources</li>
<li>Technology</li>
<li>Strategic projects</li>
</ul>
</li>
</ul>
</div><!-- END OF TOP NAVIGATION -->
"z-index: x;" resolved my conflict between CSS drop-down menus and a jQuery slider (slideshow/carousel). It was an easy fix to an issue many people seem to be having.
Try putting that under the CSS style for the drop-down ul.
Example
.navbar ul .subnav {
display: none;
z-index: 3;
}
You can play around with the number (x).

Resources