How can I close each dropdown straight away, without affecting my delay? - html

I have a little problem here with my css dropdown navigation.
When I hover over the first item, the dropdown appears, which is good. And it also has a delay when I mouse away from it, also good. This is fine as I move all the way across the top level.
However.
If I were to navigate backwards, last one, to second last one etc, I notice that the dropdowns are appearing behind the one that preceded it.
I am assuming that this is because of the order that they appear on my HTML.
Does anyone have any solutions for this? CSS or even jQuery is welcome.
I have supplied my code and jsfiddle.
Thanks all for your time!
EDIT: I just realised that my delay isn't ideal. I can mouse away from the subnav, and it stays for a few seconds, but when I mouse back into it again, it isn't clickable. Probably due to the pointer-events:none
JSFiddle: http://jsfiddle.net/4wLtmx9m/
#menu {
position: relative;
}
#navbar {
position: absolute;
margin: 0;
padding: 0;
z-index: 999;
width: 100%;
}
#navbar li {
list-style: none;
float: left;
width: 16.6%;
background-color: #F6F6F6;
text-align: center;
color:#9a9999;
/*background:url(../Assets/icons/nav-sprite-icons.png)0 20px;*/
}
#navbar li a {
display: block;
padding: 3px 8px;
text-transform: uppercase;
text-decoration: none;
color: #999;
font-weight: bold;
}
#navbar li a:hover {
color: #000;
}
#navbar li ul {
opacity:0;
top:0px;
position:absolute;
background-color:black;
z-index: -100;
left: 0;
width: 100%;
pointer-events:none;
-webkit-transition: all 0.2s ease 3s;
-moz-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease 1s;
}
#navbar li ul li {
background-color:black;
color:white;
}
#navbar li ul li a {
color:white!important;
}
#navbar li:hover ul {
opacity:1;
background-color:black;
position: absolute;
display: inline;
top:22px;
left: 0;
width: 100%;
margin: 0;
padding: 0;
z-index:-100;
-webkit-transition: all 0.2s ease 0s;
/*animation: fadein 0.2s;
-webkit-animation: fadein 0.2s;
-moz-animation: fadein 0.2s;*/
pointer-events:auto;
}
#navbar * {
}
#-webkit-keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#navbar li:hover li, #navbar li.hover li {
float: left;
background-color:black;
}
#navbar li:hover li a, #navbar li.hover li a {
color: #FFF;
}
#navbar li li a:hover {
color: #357;
}
HTML
<div id="menu">
<ul id="navbar">
<li>Occasions
<ul>
<li>Valentine's Day
</li>
<li>Easter
</li>
<li>Mother's Day
</li>
<li>Father's Day
</li>
<li>Wedding
</li>
<li>Birthday
</li>
<li>Baby
</li>
</ul>
</li>
<li>Cards & Invitations
<ul>
<li>Invitations
</li>
<li>Baby
</li>
<li>Weddings
</li>
<li>Announcements
</li>
<li>Holiday
</li>
</ul>
</li>
<li>Canvas Prints
<ul>
<li>Full Wrap
</li>
<li>Colour Edge Wrap
</li>
<li>Frame
</li>
</ul>
</li>
<li>Mugs
<ul>
<li>11oz Single Image Mug
</li>
<li>11oz Double Image Mug
</li>
<li>11oz Scrapbook Mug
</li>
<li>11oz Fullwrap Mug
</li>
<li>14oz Travel Mug
</li>
<li>17oz Latte Mug
</li>
</ul>
</li>
<li>Device Cases
<ul>
<li>Smartphones
</li>
<li>Tablets
</li>
<li>iPods
</li>
</ul>
</li>
<li>Photo Gifts
<ul>
<li>Keychains
</li>
<li>Mousepads
</li>
<li>Playing Cards
</li>
<li>Puzzles
</li>
<li>T-Shirts
</li>
</ul>
</li>
</ul>
</div>

Rather than read and tweak your code, I wrote a working example with minimal CSS. Hope it helps.
#navbar {
white-space: nowrap;
}
#navbar li {
list-style: none;
position: relative;
display: inline-block;
margin: 0 1em 0 0;
padding: 0 0 1em;
}
#navbar li ul {
display: none;
padding: 0;
margin: .5em 0 0;
width: 10em;
position: absolute;
left: 0;
}
#navbar li li {
display: block;
margin: 0 0 .5em;
padding: 0;
}
#navbar>li:hover>ul {
display: block;
}
<ul id="navbar">
<li>
Occasions
<ul>
<li>
Valentine's Day
</li>
<li>
Easter
</li>
<li>
Mother's Day
</li>
<li>
Father's Day
</li>
<li>
Wedding
</li>
<li>
Birthday
</li>
<li>
Baby
</li>
</ul>
</li>
<li>
Cards & Invitations
<ul>
<li>
Invitations
</li>
<li>
Baby
</li>
<li>
Weddings
</li>
<li>
Announcements
</li>
<li>
Holiday
</li>
</ul>
</li>
<li>
Canvas Prints
<ul>
<li>
Full Wrap
</li>
<li>
Colour Edge Wrap
</li>
<li>
Frame
</li>
</ul>
</li>
<li>
Mugs
<ul>
<li>
11oz Single Image Mug
</li>
<li>
11oz Double Image Mug
</li>
<li>
11oz Scrapbook Mug
</li>
<li>
11oz Fullwrap Mug
</li>
<li>
14oz Travel Mug
</li>
<li>
17oz Latte Mug
</li>
</ul>
</li>
<li>
Device Cases
<ul>
<li>
Smartphones
</li>
<li>
Tablets
</li>
<li>
iPods
</li>
</ul>
</li>
<li>
Photo Gifts
<ul>
<li>
Keychains
</li>
<li>
Mousepads
</li>
<li>
Playing Cards
</li>
<li>
Puzzles
</li>
<li>
T-Shirts
</li>
</ul>
</li>
</ul>

Related

How can I stop my menu from expanding when I display subitems as a flyout?

I am totally new to CSS and trying to take some HTML code, and style it into a mix between a dropdown and flyout menu. I have been successful so far in completing most of my goals, however there is still one big problem I am running into.
The container is expanding to match the flyout menu that is displayed, even though it should be a separate menu.
I am assuming I either need to rework my whole design, or there is a small simple thing I am missing. Is there a way to stop the parent containers from expanding just because a child is displayed?
Here is what the HTML code looks like:
<nav>
<ul class="top-level">
<li>
<span>Services</span>
<ul class="drop-down">
<li>
<span>Website Development</span>
<ul class="fly-out">
<li>
<span>Responsive Website Design</span>
</li>
<li>
<span>E-Commerce</span>
</li>
<li>
<span>DNN Consulting & Development</span>
<ul class="fly-out">
<li>
<span>Jobs in Rock County Case Study</span>
</li>
</ul>
</li>
<li>
<span>Website Hosting</span>
<ul class="fly-out">
<li>
<span>Site Security</span>
</li>
</ul>
</li>
<li>
<span>What Is Custom Design?</span>
</li>
<li>
<span>Conversion Rate Optimization</span>
</li>
</ul>
</li>
<li>
<span>App Development</span>
</li>
<li>
<span>Marketing Automation</span>
</li>
<li>
<span>Online Marketing</span>
<ul class="fly-out">
<li>
<span>Search Engine Optimization</span>
</li>
<li>
<span>Paid Search Marketing</span>
</li>
<li>
<span>Local SEO for Businesses</span>
</li>
<li>
<span>Social Media Marketing</span>
<ul class="fly-out">
<li>
<span>Social Media Services</span>
</li>
</ul>
</li>
<li>
<span>Conversion Rate Optimization</span>
</li>
<li>
<span>Email Marketing</span>
</li>
</ul>
</li>
<li>
<span>ADA Compliance Websites</span>
</li>
</ul>
</li>
<li>
<span>Our Work</span>
<ul class="drop-down">
<li>
<span>Manufacturing</span>
</li>
<li>
<span>E-Commerce</span>
</li>
<li>
<span>Health & Wellness</span>
</li>
<li>
<span>Business Services</span>
</li>
<li>
<span>Government & Non-Profit</span>
</li>
<li>
<span>Print</span>
</li>
</ul>
</li>
<li>
<span>Resources</span>
<ul class="drop-down">
<li>
<span>Blog</span>
</li>
<li>
<span>Tools</span>
<ul class="fly-out">
<li>
<span>Responsive Site Test</span>
</li>
<li>
<span>Conversion & Traffic Calculator</span>
</li>
<li>
<span>Website Design RFP</span>
</li>
<li>
<span>Google Review Generator</span>
</li>
<li>
<span>Project Estimator</span>
</li>
</ul>
</li>
<li>
<span>Support</span>
<ul class="fly-out">
<li>
<span>FTP Request</span>
</li>
<li>
<span>Submit a Ticket</span>
</li>
<li>
<span>Terms Of Service</span>
</li>
<li>
<span>SEO Tutorials</span>
<ul class="fly-out">
<li>
<span>Introduction To Analytics</span>
</li>
</ul>
</li>
<li>
<span>CMS Tutorials</span>
</li>
<li>
<span>Website Design RFP</span>
</li>
</ul>
</li>
<li>
<span>Business Partners</span>
</li>
<li>
<span>FAQs</span>
</li>
<li>
<span>Plugins and Modules</span>
</li>
<li>
<span>Case Studies</span>
</li>
<li>
<span>eBooks/Webinars</span>
</li>
</ul>
</li>
<li>
<span>Company</span>
<ul class="drop-down">
<li>
<span>Testimonials</span>
</li>
<li>
<span>Community Involvement</span>
</li>
<li>
<span>News</span>
</li>
<li>
<span>Careers</span>
</li>
<li>
<span>Meet Our Team</span>
</li>
</ul>
</li>
<li>
<span>Contact</span>
</li>
</ul>
</nav>
And here is the CSS:
$nav-dark: rgb(34, 34, 34);
$nav-light: rgb(240, 255, 240);
$menu-green-dark: rgb(91, 146, 121);
$menu-green: rgb(138, 178, 153);
$menu-green-light: rgb(150, 194, 174);
//outer list
.top-level{
list-style-type: none;
margin: 0px;
padding: 0px;
top: 0px;
left: 0px;
position: fixed;
//overflow: hidden;
}
//make dropdown visible on hovering
//top-level list item
.top-level li:hover .drop-down{
visibility: visible;
display: block;
}
//list inside .top-level
.drop-down{
list-style-type: none;
overflow: visible;
margin-top: 6px;
padding: 0px;
visibility: hidden;
position: fixed;
display:none;
}
//lists inside dropdown or other flyouts
.fly-out{
list-style-type: none;
overflow: visible;
margin: 0px;
padding: 0px;
top: 0;
left: 100%;
position: fixed;
}
//make flyout visible on hovering
//.drop-down list item
.drop-down li:hover .fly-out{
display: block;
visibility: visible;
}
//inside lists
.drop-down li .fly-out{
display: none;
visibility: hidden;
position: relative;
}
.fly-out li .fly-out li{
display: none;
visibility: hidden;
}
.fly-out li:hover .fly-out li{
display: block;
visibility: visible;
position: relative;
background-color: $menu-green-light;
}
//outer list item's text
.top-level li > a,
.top-level li > span {
padding: 4px;
display: block;
color: $nav-light
}
//headers for list items inside .top-level
.drop-down li > a,
.drop-down li > span {
color: $nav-light;
}
//headers for list items inside .top-level
.fly-out li > a,
.fly-out li > span {
color: $nav-light;
}
//outer list items
.top-level > li{
float: left;
background-color: $nav-dark;
padding: 6px;
}
//list items inside .top-level
.drop-down > li{
background-color: $menu-green-dark;
}
.fly-out > li{
background-color: $menu-green;
}
Right now I am wondering if has something to do with my use of display: none/block to make things appear and come back, but I can't really say for sure.
If its easier here is a link to the codepen where I am working on it.
Since your code is too long, I have created a similar structure so that it is easier to understand. You should use absolute positioning relative to the parent <li> to align the dropdowns.
a {
text-decoration: none;
color: inherit;
}
ul {
list-style: none;
padding-left: 0;
width: 240px;
display: flex;
justify-content: space-between;
background: #333;
color: #fff;
}
li {
padding: 1em;
}
li:hover {
background: #444;
}
.submenu {
display: none;
position: absolute;
top: 3em;
left: 0;
}
.submenu:hover {
display: block;
}
.submenu-header {
position: relative;
}
.submenu-header:hover>.submenu {
display: block;
}
.sub-submenu {
display: none;
position: absolute;
top: 0;
left: 240px;
}
.sub-submenu:hover {
display: block;
}
.sub-submenu-header {
position: relative;
}
.sub-submenu-header:hover>.sub-submenu {
display: block;
}
<nav>
<ul>
<li>Link1</li>
<li class='submenu-header'>
Link2
<ul class='submenu'>
<li>link4</li>
<li class='sub-submenu-header'>
link5
<ul class="sub-submenu">
<li>link7</li>
<li>link8</li>
</ul>
</li>
<li>link6</li>
</ul>
</li>
<li>Link3</li>
</ul>
</nav>
You can check my codepen here.

How to make sub sub menu work in my navigation?

Im having some problems with CSS, sub sub (third, fourth level) menus don't work and can't make it work I already tried everything I could think off. Anybody have the time to look at my code, please. I played with the code and tried all sorts of thing just nothing works.
I tried with
.navigation-1 ul li ul li ul li
but can't find the problem. I guess my css skills are not that good, lol :P
.navigation-1{
float: left;
width: auto;
margin-right: 0px;
}
.navigation-1 ul > li{
float: left;
width: auto;
position: relative;
}
.navigation-1 li:last-child{
margin-right: 0px;
}
.navigation-1 ul > li > a{
display: inline-block;
padding: 26px 30px;
font-size: 15px;
text-transform: capitalize;
/*font-family: 'Exo', sans-serif;*/
}
.navigation-1 > ul > li:after,
.navigation-1 > ul > li:before{
position: absolute;
content: "";
top:50%;
left: 0px;
bottom: 0px;
height: 10px;
width: 2px;
margin: 15px auto 0px;
right: 0px;
opacity: 0;
}
.navigation-1 > ul > li:before{
padding: 0px 5px;
border-left: 2px solid #2f3539;
border-right: 2px solid #2f3539;
opacity: 0;
}
.navigation-1 > ul > li:after{
border-right: 2px solid #2f3539;
height: 15px;
width: 2px;
opacity: 0;
}
.navigation-1 ul li ul{
position: absolute;
left: 0px;
right: 0px;
top:100%;
width: 195px;
background: #171e22;
visibility: hidden;
opacity: 0;
overflow: hidden;
z-index: 9999;
}
.navigation-1 ul li ul li{
float: left;
width: 100%;
}
.navigation-1 > ul > li.active:after,
.navigation-1 > ul > li.active:before,
.navigation-1 > ul > li:hover:after,
.navigation-1 > ul > li:hover:before{
opacity: 1;
}
nav.navigation-1 ul li:hover ul{
visibility: visible;
opacity: 1;
}
nav.navigation-1 ul li ul li a{
border-bottom: 1px solid #2f3539;
color: #fff;
display: inline-block;
padding:9px 15px;
position: relative;
width: 100%;
}
.navigation-1 ul li ul li:hover a{
background: #dc1937;
border-color: #dc1937;
color:#fff !important;
}
<nav class="navigation-1">
<ul>
<li class="active">home
<ul class="sub-menu children">
<li>Home Light</li>
</ul>
</li>
<li>artist
<ul class="sub-menu children">
<li>artist</li>
<li>artist 02</li>
<li>artist 03</li>
<li>dj</li>
</ul>
</li>
<li class="menu-item ">
event
<ul class="sub-menu children">
<li>
event list
</li>
<li>
event list 02
</li>
<li>
event list 03
</li>
<li>
event detail
</li>
</ul>
</li>
<li class="menu-item ">music
<ul class="sub-menu children">
<li>
dj
</li>
<li>
video
</li>
<li>
video list
</li>
<li>
video detail
</li>
<li>
mp3 list
</li>
<li>
music artist albums
</li>
<li>
music albums
</li>
<li>
masonry gallary
</li>
</ul>
</li>
<li class="menu-item ">blog
<ul class="sub-menu children">
<li>
blog detail
</li>
<li>
blog left sidebar
</li>
<li>
blog right sidebar
</li>
<li>
blog full
</li>
<li>
blog medium
</li>
<li>
blog small
</li>
<li>
masonry small
</li>
</ul>
</li>
<li class="menu-item ">
page
<ul class="sub-menu children">
<li>
shop
</li>
<li>
shop items
</li>
<li>
shop listing
</li>
<li>
headers
</li>
</ul>
</li>
<li>contact us</li>
</ul>
</nav>
Here is the original HTML code (without sub sub menus, as I already have my navigation managed through my CMS)
Thank you
R

Menu different in chrome browser

for some reason my menu bar (its fixed) is in 2 lines in chrome browser and normal in all other browsers. Any idea why or how to fix it? I tried to figure it out but i didnt fix it. Is it a problem with browser default block height or what? I need to make it work on chrome and on all other browsers too.
JsFiddle: https://jsfiddle.net/wkupr9L6/1/
HTML:
<script>
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 65) {
$("nav").css("opacity", "0.2");
}
else {
$("nav").css("opacity", "1");
}
});
</script>
</head>
<body>
<!--MENU BAR!-->
<nav class="navig">
<span class="nadpis"> RPO </span>
<ul class="nav">
<li class="prve">Dátumy
<ul>
<li>1-7/7/2016
<ul>
<li>1/7/2016</li>
<li>2/7/2016</li>
<li>3/7/2016</li>
<li>4/7/2016</li>
<li>5/7/2016</li>
<li>6/7/2016</li>
<li>7/7/2016</li>
</ul>
</li>
<li>8-14/7/2016
<ul>
<li>8/7/2016</li>
<li>9/7/2016</li>
<li>10/7/2016</li>
<li>11/7/2016</li>
<li>12/7/2016</li>
<li>13/7/2016</li>
<li>14/7/2016</li>
</ul>
</li>
<li>15-21/7/2016
<ul>
<li>15/7/2016</li>
<li>9/7/2016</li>
<li>10/7/2016</li>
<li>11/7/2016</li>
<li>12/7/2016</li>
<li>13/7/2016</li>
<li>14/7/2016</li>
</ul>
</li>
</ul>
</li>
<li class="druhe">&#9776
<ul>
<li> FLV
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul>
</li>
<li> FLC
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul>
</li>
<li> QUA
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul>
</li>
<li> HFX
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul>
</li>
<li> PDT
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul></li>
<li> RSH
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul>
</li>
<li> BUR
<ul>
<li>meno1 </li>
<li>meno2 </li>
<li>meno3 </li>
<li>meno4 </li>
<li>meno5 </li>
</ul>
</li>
<li> SUHRN </li>
<li> INCI </li>
<li> JIRA </li>
<li> CHGT </li>
<li> TASK </li>
<li> VRS </li>
</div>
</ul>
</li>
</ul>
</nav>
CSS:
body, nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav {
display: inline-block;
position: fixed;
width: 100%;
text-align: center;
background-color: #111;
vertical-align: top;
top: -1px;
opacity: 1;
transition: 0.3s;
}
nav:hover {
opacity: 1!important;
background-color: #111;
transition: 0.3s;
}
.nav a {
display: block;
background: #111;
color: #fff;
text-decoration: none;
padding: 0.7em 1.7em;
text-transform: uppercase;
font-size: 85%;
letter-spacing: 3px;
position: relative;
}
.nav{
vertical-align: top;
display: inline-block;
}
.nav li {
position: relative;
}
.nav > li {
float: left;
margin-right: 1px;
}
.nav li:hover > a {
transition: 0.3s;
background-color:#3a3939;
color: #40d23b;
}
.nav ul {
position: absolute;
white-space: nowrap;
z-index: 1;
left: -99999em;
background-color: #000;
border: 2px solid #81D4FA;
border-top: none;
}
.nav > li:hover > ul {
left: auto;
min-width: 100%;
}
.nav > li li:hover > ul {
left: 100%;
top:-1px;
}
.nav > li:hover > a:first-child:nth-last-child(2):before {
border: 5px solid transparent;
}
.nav li li:hover > a:first-child:nth-last-child(2):before {
border: 5px solid transparent;
right: 10px;
}
.prve{
max-width:125px;
min-width: 90px;
border: 2px solid #81D4FA;
border-bottom: none;
border-top: none;
}
.druhe {
max-width: 14px;
min-width: 110px;
border-right: 2px solid #81D4FA;
}
span {
float:left;
margin-left: 3px;
}
span a{
text-decoration: none;
color:#2670CF;
background-color:#111;
font-family: 'Helvetica Neue', sans-serif;
font-size: 30px;
font-weight: bold;
}
Thanks for help
This doesn't seem like a browser issue. You have .nav set to display: inline-block; but nothing on the two inner <li> elements to force them onto the same line.
I added this:
.nav > li {
display: inline-block;
}
And it works for me in Chrome. See here:
https://jsfiddle.net/tobyl/wkupr9L6/6/

triple tier drop down menu

I have been trying to make a menu that has 3 tiers, for example i want to hover over 'family' and be shown 'holidays' and 'day Trips'. Then I want to hover 'holidays' or 'day trips' and be shown the next options 'videos 1-3'. I have only been doing HTML5 and CSS3 for a few weeks so I am quite green. Any help would be great.
<ul id="menu2">
<li> Family
<ul class="sub-menu2">
<li>Holidays
<li> Video 1 </li>
<li> Video 2 </li>
<li> Video 3 </li>
</li>
<li>Day Trips
<li> Video 1 </li>
<li> Video 2 </li>
<li> Video 3 </li>
</li>
</ul>
</li>
</ul>
CSS
#menu2, ul#menu2 ul.sub-menu2 {
padding:0;
margin-top: -41px;
}
#menu2 li, ul#menu2 ul.sub-menu2 li {
list-style-type: none;
display: inline-block;
width:100px;
left:73%;
margin-bottom:4px;
}
#menu2 li a, ul#menu2 li ul.sub-menu2 li a {
text-decoration: none;
text-align:center;
color: yellow;
background: black;
padding: 5px;
display:inline-block;
width:100px;
border-bottom-right-radius:20px;
border-top-left-radius: 20px;
border: 2px solid yellow;
}
#menu2 li {
position: relative;
}
#menu2 li ul.sub-menu2 {
display:none;
position: absolute;
top: 30px;
right: 72px;
width: auto;
margin-top:6px;
margin-bottom:-2px;
}
#menu2 li:hover ul.sub-menu2 {
display:block;
}
#menu2 li ul.sub-menu2 a:hover {
background-color: yellow;
color: black;
}
Your structure is not correct. It should be like this:
<ul id="menu2">
<li>Family
<ul class="sub-menu2">
<li>Holidays
<ul>
<li>Video 1</li>
<li>Video 2</li>
<li>Video 3</li>
</ul>
</li>
<li>Day Trips
<ul>
<li> Video 1 </li>
<li> Video 2 </li>
<li> Video 3 </li>
</ul>
</li>
</ul>
</li>
</ul>
And you have to modify your CSS a little bit. I made a little dummy here:
generic DEMO Fiddle

how can I make a full width dropdown responsive menu

I am somehow not been able to manage this menu to full width
this is my codepen
http://codepen.io/anon/pen/xwDcb
i want my dropdown menu width to be 100% from left to right. What am I doing wrong
body {
background-color:#000;
}
.toggleMenu {
display: none;
background: #666;
padding: 10px 15px;
color: #fff;
text-transform: uppercase;
font-weight: bold;
width:100%;
}
.nav-full {
background:url(../images/nav-bg.png) no-repeat 0 0;
}
.nav-centre {
width:960px;
margin:0 auto
}
.nav {
list-style: none;
*zoom: 1;
}
.nav:before, .nav:after {
content:" ";
display: table;
}
.nav:after {
clear: both
}
.nav ul {
list-style: none;
}
my html code
<a class="toggleMenu" href="#">Menu</a>
<div class="nav-full">
<div class="nav-centre">
<ul class="nav">
<li>HOME
<ul>
<li>Indus Advantage
</li>
<li>Positioning and flexibility of products
</li>
<li>Pipeline
</li>
</ul>
</li>
<li> Products
<ul>
<li>Overview
</li>
<li>Exercise Physiology
</li>
<li>Manufacturing & Quality Control
</li>
</ul>
</li>
<li> Patents & Publications
<ul>
<li>Global Patenting Strategy
</li>
<li>Publications
</li>
</ul>
</li>
<li> Partnering
<ul>
<li>Enquiries - Product
</li>
<li>Enquiries - Business Partnering
</li>
</ul>
</li>
<li> About Us
<ul>
<li>Vision & Values
</li>
<li>Conventional v/s the Indus Discovery Model
</li>
</ul>
</li>
<li> Contact Us
</li>
<li> Careers
</li>
</ul>
</div>
</div>
check with this code
<style>
#nav {
height: 1;
list-style-type: none;
padding-top: 1.25em;
margin-top: 0em;
}
#nav > li { /* Added ">" */
float: right;
position: relative;
padding: 0;
}
#nav li a {
display: inline-block; /* was block */
font-size: 14px;
padding: 0 1em;
margin-bottom: 1em;
color: #333;
text-decoration: none;
border-left: 1px solid #333;
}
#nav .last, #nav li ul li a {
border-left: none;
}
#nav li a:hover, #nav li a:focus {
color: #666;
}
#nav li ul {
opacity: 0;
/*position: absolute;
right: 0em; */
list-style-type: none;
padding: 0; margin: 0;
}
#nav li:hover ul {
opacity: 1;
}
#nav li ul li {
/*float: none;
position: static;
width: auto;*/
height: 0;
line-height: 0;
background: none;
text-align: left;
margin-bottom: .75em;
}
#nav li:hover ul li {
height: 25px;
line-height: 2.5em;
}</style>
<ul id="nav">
<a class="toggleMenu" href="#">Menu</a>
<div class="nav-full">
<div class="nav-centre">
<ul class="nav">
<li>HOME
<ul>
<li>Indus Advantage
</li>
<li>Positioning and flexibility of products
</li>
<li>Pipeline
</li>
</ul>
</li>
<li> Products
<ul>
<li>Overview
</li>
<li>Exercise Physiology
</li>
<li>Manufacturing & Quality Control
</li>
</ul>
</li>
<li> Patents & Publications
<ul>
<li>Global Patenting Strategy
</li>
<li>Publications
</li>
</ul>
</li>
<li> Partnering
<ul>
<li>Enquiries - Product
</li>
<li>Enquiries - Business Partnering
</li>
</ul>
</li>
<li> About Us
<ul>
<li>Vision & Values
</li>
<li>Conventional v/s the Indus Discovery Model
</li>
</ul>
</li>
<li> Contact Us
</li>
<li> Careers
</li>
</ul>
</ul>
</div>
</div>
you have to give the nav-center class 100%, now its at 975px or something like that, and it wrapps your list elements. so the 100% of the unordered list are relative to the nav-center element.
and if you want to get the nav menu centered giv the nav-centre class position:relative;
left: 50% and margin:left -511px. (margin-left should be have of the width of the unordered list)
i think the best solution would be that you put the dropdown menu out of the ul from the navi.
So its not relative to the other list.
markup your html like this:
<a class="toggleMenu" href="#">Menu</a>
<div class="nav-full">
<div class="nav-centre">
<ul class="nav">
<li>HOME</li>
<li> Products</li>
<li> Patents & Publications</li>
<li> Partnering</li>
<li> About Us</li>
<li> Contact Us</li>
<li> Careers </li>
</ul>
<ul>
<li class="under">Indus Advantage</li>
<li class="under">Positioning and flexibility of products</li>
<li class="under">Pipeline
</ul>
<ul>
<li class="under">Overview</li>
<li class="under">Exercise Physiology</li>
<li class="under">Manufacturing & Quality Control</li>
</ul>
<ul>
<li class="under">Global Patenting Strategy</li>
<li class="under">Publications</li>
</ul>
<ul>
<li class="under">Enquiries - Product</li>
<li class="under">Enquiries - Business Partnering</li>
</ul>
<ul>
<li class="under">Vision & Values</li>
<li class="under">Conventional v/s the Indus Discovery Model</li>
</ul>
</div>
</div>
you now just have to give li.under position:absolute and the rest, how to style, should be clear.