Slide in border from left to right, when hovering UL menu - html

I want this border to slide in from left to right(dropmenus only). But can't figure it out
This is how I got so far, I don't have any ideas no more.
Menu is built with ul and li-s.
Is this possible?
Thanks,
.toggle,
[id^=drop] {
display: none;
}
.toggle_menu,
[id^=drop] {
display: none;
}
nav:after {
content:"";
display:table;
clear:both;
}
nav ul {
padding:0;
margin:0;
list-style: none;
position: relative;
}
nav ul li.active_link a{
font-size:14px;
text-decoration:none;
font-family: 'Lato';
font-weight:600;
}
nav ul li {
margin: 0px;
display:inline-block;
float: left;
background-color: white;
}
nav a {
display:block;
padding: 14px 16px;
color:#FFF;
font-size:14px;
text-decoration:none;
color:black;
font-family: 'Lato';
font-weight:400;
}
nav ul li ul li:hover { /*background: #000000; */}
nav a:hover {
/*background-color: #000000;*/
}
nav ul li ul{
display: none;
position: absolute;
color: #31302B;
background: #FFF;
cursor: pointer;
box-shadow: inset 0 0 0 0 #b6945d;
-webkit-transition: all ease 1s;
-moz-transition: all ease 1s;
transition: all ease 1s;
}
nav ul li:hover > ul{
box-shadow: inset 900px 0px 0px #b6945d;
color: #fff;
}
nav ul li:hover > ul {
display:inherit;
}
nav ul ul li {
background-color: transparent;
width: auto;
float: left;
display: list-item;
position: relative;
}
nav ul ul ul li {
position: relative;
top:-60px;
left:170px;
}
nav ul li ul li a{
font-style: italic;
background-color: white;
margin-top: 1px;
}
nav ul li ul li a:hover{
font-style:italic;
color:#b6945d;
}
/*li > a:after { content: ' +'; }*/
li > a:only-child:after { content: ''; }
<nav>
<label for="drop" class="toggle_menu"><img src="assets/images/mobile_button.png"></label>
<input type="checkbox" id="drop" />
<ul class="menu">
<li class="active_link">
Avaleht
</li>
<li>
<label for="drop-1" class="toggle">Kunstnik</label>Kunstnik
<input type="checkbox" id="drop-1"/>
<ul>
<li>Kunstnikust</li>
<li>Tööde arhiiv</li>
</ul>
</li>
<li>
<label for="drop-2" class="toggle">E-pood</label>E-pood
<input type="checkbox" id="drop-2"/>
<ul>
<li>Kõik tooted</li>
<li>Seeriatooted</li>
</ul>
</li>
</ul>
</nav>

I have added 10 line css below: Are you looking for this:
.toggle,
[id^=drop] {
display: none;
}
.toggle_menu,
[id^=drop] {
display: none;
}
nav:after {
content:"";
display:table;
clear:both;
}
nav ul {
padding:0;
margin:0;
list-style: none;
position: relative;
}
nav ul li.active_link a{
font-size:14px;
text-decoration:none;
font-family: 'Lato';
font-weight:600;
}
nav ul li {
margin: 0px;
display:inline-block;
float: left;
background-color: white;
}
nav a {
display:block;
padding: 14px 16px;
color:#FFF;
font-size:14px;
text-decoration:none;
color:black;
font-family: 'Lato';
font-weight:400;
}
nav ul li ul li:hover { /*background: #000000; */}
nav a:hover {
/*background-color: #000000;*/
}
nav ul li ul{
display: none;
position: absolute;
color: #31302B;
background: #FFF;
cursor: pointer;
box-shadow: inset 0 0 0 0 #b6945d;
-webkit-transition: all ease 1s;
-moz-transition: all ease 1s;
transition: all ease 1s;
}
nav ul li:hover > ul{
box-shadow: inset 900px 0px 0px #b6945d;
color: #fff;
}
nav ul li:hover > ul {
display:inherit;
}
nav ul ul li {
background-color: transparent;
width: auto;
float: left;
display: list-item;
position: relative;
}
nav ul ul ul li {
position: relative;
top:-60px;
left:170px;
}
nav ul li ul li a{
font-style: italic;
background-color: white;
margin-top: 1px;
}
nav ul li ul li a:hover{
font-style:italic;
color:#b6945d;
}
/*li > a:after { content: ' +'; }*/
li > a:only-child:after { content: ''; }
/**New css for transition**/
nav ul li ul:after {
content: '';
display: block;
border-bottom: 4px solid red;
width: 0;
position: absolute;
left: 0;
-webkit-transition: 1s ease;
transition: 1s ease;
}
nav ul li ul:hover:after {
width: 100%;
}
<nav>
<label for="drop" class="toggle_menu"><img src="assets/images/mobile_button.png"></label>
<input type="checkbox" id="drop" />
<ul class="menu">
<li class="active_link">
Avaleht
</li>
<li>
<label for="drop-1" class="toggle">Kunstnik</label>Kunstnik
<input type="checkbox" id="drop-1"/>
<ul>
<li>Kunstnikust</li>
<li>Tööde arhiiv</li>
</ul>
</li>
<li>
<label for="drop-2" class="toggle">E-pood</label>E-pood
<input type="checkbox" id="drop-2"/>
<ul>
<li>Kõik tooted</li>
<li>Seeriatooted</li>
</ul>
</li>
</ul>
</nav>

Now it works.
.menu {
width: 100%;
height: auto;
background: white;
transition: all 0.3s ease;
}
.menu ul {
padding: 0px;
margin: 0px;
list-style: none;
position: relative;
display: inline-block;
width:100%;
}
.menu > li > ul.sub_menu {
min-width: 10em;
padding: 4px 0;
background-color: #f4f4f4;
border: 1px solid #fff;
}
.menu ul li { padding: 0px; }
.menu ul li.active a{
font-weight:600;
}
.second_menu ul li.active a{
font-weight:600;
}
.menu > ul > li { display: inline-block; }
.menu ul li a {
display: block;
text-decoration: none;
color: black;
font-family: 'Lato';
font-weight:400;
font-size:14px;
}
.menu ul li a:hover {
color: black;
}
.menu ul li.hover > a {
color: black;
}
.menu ul li > a { padding: 15px; }
.menu ul ul {
visibility: hidden;
position: absolute;
top: 100%;
width:auto;
background: white;
}
.menu ul li.active_drop a{
font-weight:600 !important;
color:#b6945d;
}
.menu ul li ul.dropdown_nav li a{
font-weight:400;
}
.menu ul li.active_drop a:hover{
color:#b6945d;
}
.menu ul li:hover > ul {
visibility: visible;
}
.menu ul ul > li {
position: relative;
display: inline;
float: left;
width: auto;
}
.menu ul ul > li a {
padding: 10px 15px;
height: auto;
background: white;
font-style:italic;
}
.menu ul ul > li a:hover {
color: black;
}
.menu ul ul ul {
position: absolute;
left: 100%;
top: 0;
}
/* animating the golden border */
.dropdown_nav {
position: relative;
overflow: hidden;
}
.dropdown_nav:before {
position: absolute;
display: block;
top: 0;
left: 0;
width: 100%;
height: 1px;
content: "";
background-color: #b6945d;
z-index: 1;
transition: transform .5s ease-out;
transform: translateX(-100%);
}
.menu>ul>li:hover .dropdown_nav:before {
transform: translateX(0);
}
<nav id="menu" class="menu">
<ul class="dropdown">
<li>leht</li>
<li class="active">
leht1
<ul class="dropdown_nav">
<li class="dropdown_first active_drop">
leht1.1</li>
<li class="dropdown_last">leht1.2</li>
</ul>
</li>
<li>
leht2
<ul class="dropdown_nav">
<li class="dropdown_first">leht2.1</li>
<li>leht2.2</li>
</ul>
</li>
<li>leht3</li>
<li>leht4</li>
</ul>
</nav>

Related

Equal horizontal space between links in responsive navigation?

I am trying to make horizontal menu navigation. I have several links in navigation, and I would like to have equal horizontal space between them.
How to make links in horizontal menu with equal space between them?
HTML:
<div id="header">
<div class="secondary-navigation">
<div itemscope itemtype="http://schema.org/SiteNavigationElement">
<nav id="navigation">
<ul id="menu-main" class="menu">
<li class="menu-item">Link</li>
<li class="menu-item">Link</li>
<li class="menu-item">Link</li>
<li class="menu-item">Link</li>
<li class="menu-item">Link</li>
<li class="menu-item">Link</li>
<li class="menu-item">Link</li>
<li class="menu-item">Link</li>
</ul>
Menu
</nav>
</div>
</div>
</div>
CSS:
#header {
position: relative;
float: left;
padding: 0 0 0 0;
clear: both;
}
/*-----------------------------------------------
/* Header navigation
/*---------------------------------------------*/
.secondary-navigation {
display: block;
width: 100%;
float: left;
}
.secondary-navigation a {
vertical-align: top;
color: #F1F1F1;
font-weight: bold;
margin-top: 8px;
margin-bottom: 4px;
line-height:18px;
font-size: 15px;
border-bottom: 2px solid #333888;
}
.secondary-navigation a:hover, .secondary-navigation .sfHover {
color: #F1F1F1;
border-bottom: 2px solid #F1F1F1;
}
.secondary-navigation li li a { line-height: 1 }
.secondary-navigation a .sub {
font-size: 12px;
font-weight: normal;
color: #CFCFCF;
text-transform: none;
}
.menu-item-has-children > a:after {
content: "▼";
font-size: 10px;
color: #F1F1F1;
position: absolute;
right: 12px;
top: 22px;
}
.footer-navigation .menu-item-has-children > a:after { display: none }
.sub-menu .menu-item-has-children>a:after {
right: 0;
top: 17px;
}
.menu .current-menu-item > a { background: #fff }
.menu .current-menu-item > a:after {
content: "";
position: absolute;
width: 100%;
height: 1px;
background: #fff;
bottom: 0px;
left: 0;
z-index: 1;
}
#navigation {
margin: 0 auto;
font-size: 13px;
width: 100%;
float: left;
}
#navigation ul {
margin: 0 auto;
list-style: none; /*Added*/}
#navigation .menu { float: left; }
#navigation ul li {
float: left;
position: relative;
margin-left: 0;
}
#navigation > ul li:first-child a { }
#navigation > ul li:last-child a { border-right: 0 }
#navigation ul .header-search { float: right }
#navigation > ul > li:last-child { border-right: none }
#navigation ul li a, #navigation ul li a:link, #navigation ul li a:visited { display: block }
#navigation > ul > .current a {
background: transparent;
color: #555 !important;
}
#navigation li:hover ul, #navigation li li:hover ul, #navigation li li li:hover ul, #navigation li li li li:hover ul {
opacity: 1;
left: -228px;
top: 0;
}
#navigation ul ul {
position: absolute;
width: 226px;
z-index: 400;
font-size: 12px;
color: #333888;
border: 1px solid #F1F1F1;
background: #FFFFFF;
padding: 0;
}
#navigation ul ul li {
margin-left: 0;
padding: 0 10%;
width: 80%;
color: #333;
}
#navigation ul ul li:hover { background: #F1F1F1 }
#navigation ul ul a, #navigation ul ul a:link, #navigation ul ul a:visited {
padding: 12px 0;
position: relative;
border-left: 0;
background: transparent;
border-right: 0;
text-transform: none;
line-height: 1.4;
margin-right: 0;
min-height: 100%;
}
#navigation ul ul li:last-child a { border-bottom: none }
#navigation ul ul {
opacity: 0;
left: -999em;
}
#navigation ul li:hover ul {
left: -1px;
opacity: 1;
top: 81px;
}
#navigation ul ul li:hover ul {
top: -1px;
left: -228px;
padding-top: 0;
}
#navigation ul ul ul:after { border-color: transparent }
I tried something like this, but it does not work for me.
You can use justify-content: space-between or justify-content: space-around flexbox property
ul {
display: flex;
justify-content: space-between;
border: 1px solid black;
list-style-type: none;
padding: 10px;
margin: 0;
}
<ul>
<li>Random Link</li>
<li>Random Link</li>
<li>Random Link</li>
<li>Random Link</li>
</ul>

how to display a dropdown ul two per row

I have a Nav with some unordered elements displayed horizontally and then I have a submenu from one of those elements of the nav, so far I'm displaying all the elements inline but I would like to display them side by side, just two of them per line.
How it actually looks:
And how I want it to be:
Just two columns displaying elements side by side, aligned to left side (of 50% width each side).
But I can't get it done, here's what I got so far
HTML
<nav id="menu">
<ul>
<li class="menu1">HOME</li>
<li class="left">NEWS</li>
<li class="left">VIDEOS</li>
<li class="left">STYLE</li>
<li class="left">BEAUTY</li>
<li class="left">MOMS</li>
<li class="left">ENTERTAINMENT</li>
<li class="left">PETS</li>
<li class="left">NEWS
<ul>
<li>Content1</li>
<li>Content2</li>
<li>Content3</li>
<li>Content4</li>
<li>Content5</li>
<li>Content6</li>
<li>Content7</li>
<li>Content8</li>
</ul>
</li>
</nav>
CSS
#menu {
position: absolute;
left:80px;
top:50%;
transform: translate(0%,-50%);
-webkit-transform: translate(0%,-50%);
}
#menu ul {
list-style:none;
position:relative;
float:left;
margin:0;
padding:0;
top:50%;
}
#menu ul li {
display: inline;
position: relative;
}
#menu ul li a {
color: #fff;
text-decoration: none;
font-family: 'Cabin', sans-serif;
background-color: ;
position: relative;
padding-top: 12px;
padding-bottom: 10px;
padding-right: 10px;
padding-left: 10px;
transition: background-color 0.2s ease-in-out;
}
#menu ul li a.news {
color:#ec008c;
transition: color 0.2s ease-in-out;
}
#menu ul li a:hover.news {
color: #fff;
}
#menu ul li a:hover {
background-color: #ec008c;
text-decoration: none;
border-bottom: 2px solid #bf1b33;
color: #fff;
}
#menu ul ul
{
display:none;
position:absolute;
top:100%;
right: 0%;
margin-left:0px;
text-align: center;
width: 350px;
line-height: 60px;
margin-top:12px;
background-color: #243641;
}
#menu ul ul.longer {
width: 150px;
}
#menu ul ul li
{
float:none;
width:100%;
background-color: ;
}
#menu ul ul a
{
line-height: 0px;
padding:0px 5px;
width: 100%;
background-color: ;
}
#menu ul li:hover > ul
{
display:block;
}
You can do something like this :
#menu ul ul li
{
float: left;
width: 50%;
}
See working demo here
You can use display: flex on the last ul and set a flex-basis width on the children (li). See my example below.
#menu ul li:hover > ul {
display: flex;
flex-flow: row wrap;
}
#menu ul ul li {
flex-basis: 50%;
}
This is all the extra code that's needed. I also fixed your code. because the <ul> didn't have closed tag (</ul>).
#menu {
position: absolute;
left: 80px;
top: 50%;
transform: translate(0%, -50%);
-webkit-transform: translate(0%, -50%);
}
#menu ul {
list-style: none;
position: relative;
float: left;
margin: 0;
padding: 0;
top: 50%;
}
#menu ul li {
display: inline;
position: relative;
}
#menu ul li a {
color: #fff;
text-decoration: none;
font-family: 'Cabin', sans-serif;
background-color: ;
position: relative;
padding-top: 12px;
padding-bottom: 10px;
padding-right: 10px;
padding-left: 10px;
transition: background-color 0.2s ease-in-out;
}
#menu ul li a.news {
color: #ec008c;
transition: color 0.2s ease-in-out;
}
#menu ul li a:hover.news {
color: #fff;
}
#menu ul li a:hover {
background-color: #ec008c;
text-decoration: none;
border-bottom: 2px solid #bf1b33;
color: #fff;
}
#menu ul ul {
display: none;
position: absolute;
top: 100%;
right: 0%;
margin-left: 0px;
text-align: center;
width: 350px;
line-height: 60px;
margin-top: 12px;
background-color: #243641;
}
#menu ul ul.longer {
width: 150px;
}
#menu ul ul li {
float: none;
width: 100%;
background-color: ;
}
#menu ul ul a {
line-height: 0px;
padding: 0px 5px;
width: 100%;
background-color: ;
}
#menu ul li:hover > ul {
display: flex;
flex-flow: row wrap;
}
#menu ul ul li {
flex-basis: 50%;
}
<nav id="menu">
<ul>
<li class="menu1">HOME</li>
<li class="left">NEWS</li>
<li class="left">VIDEOS</li>
<li class="left">STYLE</li>
<li class="left">BEAUTY</li>
<li class="left">MOMS</li>
<li class="left">ENTERTAINMENT</li>
<li class="left">PETS</li>
<li class="left">NEWS
<ul>
<li>Content1</li>
<li>Content2</li>
<li>Content3</li>
<li>Content4</li>
<li>Content5</li>
<li>Content6</li>
<li>Content7</li>
<li>Content8</li>
</ul>
</li>
</ul>
</nav>
You should use display: inline-block; width width: 50% on #menu ul ul li elements:
#menu ul ul {
display:none;
position:absolute;
top:100%;
right: 0%;
margin-left:0px;
text-align: center;
width: 350px;
line-height: 60px;
margin-top:12px;
background-color: #243641;
font-size: 0; /* white spaces fix */
}
#menu ul ul li {
font-size: 1rem; /* white spaces fix */
float: none;
width: 50%;
display: inline-block;
background-color: ;
}
#menu ul ul a {
display: block;
padding: 0px 5px;
width: 100%;
background-color: ;
}
JSfiddle here.
This might be useful for your needs.
I don't know if you are using any framework or not, but this should work for you :)
http://alijafarian.com/bootstrap-multi-column-dropdown-menu/

List elements overlapping

I'm having troubles with my horizontal menu-bar list items overlapping.
So the ul ul li of the nav div elements overlap, what can I do to stop that?
The jsfiddle
CSS:
body, html{
padding: 0px;
margin: 0px;
}
.nav {
font-family: 'PT Sans', sans-serif;
width: 100%;
color: #F5F5F5;
background: #1565c0;
display: flex;
height: 40px;
padding: 0;
margin: 0;
border: 0;
}
.nav ul, .nav ul li, .nav{
list-style: none;
margin: 0;
padding: 0;
border-bottom: 3px solid #0d47a1;
}
.nav ul li{
background: #1565c0;
width:auto;
position: relative;
transition: background 250ms ease-in;
line-height: 40px;
display:block;
}
.nav ul li:hover{
background: #0d47a1;
}
.nav ul ul{
overflow:visible;
position: absolute;
visibility: hidden;
top: 100%;
width: 0%;
}
.nav ul ul li{
border:none;
display:block;
position: absolute;
left:0;
margin:0px;
}
.nav ul li:hover>ul{
visibility: visible;
}
.nav a{
text-decoration: none;
color: inherit;
margin: 0px 20px;
}
.nav ul ul li:last-child{
border-bottom: 3px solid #0d47a1;
}
<div class="nav">
<ul>
<li><a>Hi there</a><ul><li><a>Here is the awesomeness</a></li>
<li><a>Awesome</a></li>
</ul>
</div>
fiddle Here are some modification in your code:
.nav ul ul li {
border: medium none;
display: block;
/*left: 0;*/
margin: 0;
/*position: absolute;*/
}
.nav ul ul {
overflow: visible;
position: absolute;
top: 100%;
visibility: hidden;
/*width: 0;*/
}
you can add below css not to wrap your text in 2 lines:
.nav ul ul {
white-space: nowrap;
}
Try like this Demo
CSS:
.nav ul li > ul {
position: relative;
display:none;
}
.nav ul ul li {
border:none;
display:block;
position: relative;
left:0;
margin:0px;
}
.nav ul li:hover>ul {
display:block;
}
body, html {
padding: 0px;
margin: 0px;
}
.nav {
font-family:'PT Sans', sans-serif;
width: 100%;
color: #F5F5F5;
background: #1565c0;
display: flex;
height: 40px;
padding: 0;
margin: 0;
border: 0;
}
.nav ul, .nav ul li, .nav {
list-style: none;
margin: 0;
padding: 0;
border-bottom: 3px solid #0d47a1;
}
.nav ul li {
background: #1565c0;
width:auto;
position: relative;
transition: background 250ms ease-in;
line-height: 40px;
display:block;
}
.nav ul li:hover {
background: #0d47a1;
}
.nav ul li > ul {
position: relative;
display:none;
}
.nav ul ul li {
border:none;
display:block;
position: relative;
left:0;
margin:0px;
}
.nav ul li:hover>ul {
display:block;
}
.nav a {
text-decoration: none;
color: inherit;
margin: 0px 20px;
}
.nav ul ul li:last-child {
border-bottom: 3px solid #0d47a1;
}
<div class="nav">
<ul>
<li><a>Hi there</a>
<ul>
<li><a>Here is the awesomeness</a>
</li>
<li><a>Awesome</a>
</li>
</ul>
</li>
</ul>
</div>

Web Navigation Bar Will Not Center

Trying to get the words in my navigation bar to center. I have tried a bunch of different configs that I found online and so far no luck.
Also, is there anything I can do to make the navigation bar appear cleaner and more professional?
Thank you in advance
<div class="nav-container clearfix">
<ul id="nav">
<li class="first"><span>Home</li>
<li><span>Why Soy?</li>
<li><span>Candle Sold, Tree Planted</li>
<li><span>Build-a-Candle</li>
<li><span>Contact Us</li>
<li><a class="category" href="<?php echo Mage::getBaseUrl(); ?>all-products">
<span>Buy Products</span>
<ul class="level0">
<?php echo $_menu ?>
</ul>
</a>
</li>
</ul>
/*** CLEARFIX ******/
.clearfix:before,
.clearfix:after {
content: "";
display: table;
clear: both
}
/********** < Navigation */
.nav-container {clear: both; width:100%; float: left; text-align: center; margin: 10px 0px 10px; text-transform: uppercase; font-weight: bold; display: inline; background:#d4dadd !important; box-shadow: 10px 10px 5px #888888 !important; }
#nav { margin:0 auto; padding:0; font-size:12px; }
/* All Levels */ /* Style consistent throughout all nav levels */
#nav li {
display: inline-block;
padding: 5px;
margin: 5px;
border-right: 1px solid #000;
list-style: none;
vertical-align: top;
height: 50px;
position:relative;
}
#nav li.over { z-index:998; background-color: #b3bec3; }
#nav a,
#nav a:hover { display:block; line-height:1.3em; text-decoration:none; padding: 10px;
text-align: center; }
#nav span { display:block; cursor:pointer; }
#nav li ul span {white-space:normal; }
#nav ul li.parent a {}
#nav ul li.parent li a { background-image:none; }
#nav a.category span { background: url(../images/nav-category.gif) no-repeat center right; padding-right: 20px; }
/* 0 Level */
#nav li.active a { color:#2882ce; }
#nav a { font-size: 115%; color:#303030; }
#nav li.last a { padding-right: 0px !important;}
#nav li.over a,
#nav a:hover { color:#2882ce; }
/* 1st Level */
#nav ul li,
#nav ul li.active { float:none; margin:0; padding-bottom:1px; background:#d4dadd; }
#nav ul li.last { background:#d4dadd; padding-bottom:0; }
#nav ul a,
#nav ul a:hover { float:none; padding:0; background:none; }
#nav ul li a { font-size: 100% !important; font-weight:normal !important; }
/* 2nd Level */
#nav ul,
#nav div { position:absolute; width:15em; top:27px; left:-10000px; border:1px solid #899ba5; }
#nav div ul { position:static; width:auto; border:none; }
/* 3rd+ Level */
#nav ul ul,
#nav ul div { top:5px; }
#nav ul li a { background:#d4dadd; }
#nav ul li a:hover { background:#b3bec3; }
#nav ul li a,
#nav ul li a:hover { color:#2f2f2f !important; }
#nav ul span,
#nav ul li.last li span { padding:3px 15px 4px 15px; }
/* Show menu */
#nav li ul.shown-sub,
#nav li div.shown-sub { left:0; z-index:999; }
#nav li .shown-sub ul.shown-sub,
#nav li .shown-sub li div.shown-sub { left:100px; }
<div class="nav-container clearfix">
<ul id="nav">
<li class="first"><span>Home</li>
<li><span>Why Soy?</li>
<li><span>Candle Sold, Tree Planted</li>
<li><span>Build-a-Candle</li>
<li><span>Contact Us</li>
<li><a class="category" href="<?php echo Mage::getBaseUrl(); ?>all-products">
<span>Buy Products</span>
<ul class="level0">
<?php echo $_menu ?>
</ul>
</a>
</li>
</ul>
I changed your code a bit, here is a snippet below, to see this snippet working click Full Page button.
UPDATED snippet based on OP's Comments to answer.
/*** CLEARFIX ******/
.clearfix:before,
.clearfix:after {
content: "";
display: table;
clear: both
}
/********** < Navigation */
.nav-container {
clear: both;
width: 100%;
float: left;
margin: 10px 0px 10px;
text-transform: uppercase;
font-weight: bold;
display: inline;
background: #ecf3f6 !important;
box-shadow: 10px 10px 5px #888888 !important;
}
#nav {
margin: 0 auto;
padding: 0;
font-size: 12px;
}
/* All Levels */
/* Style consistent throughout all nav levels */
#nav li {
display: inline-block;
margin: 5px 0;
border-right: 1px solid #000;
list-style: none;
vertical-align: top;
height: 70px;
width:16.3%
}
#nav li:last-child {
border-right: 0
}
#nav li.over {
z-index: 998;
background-color: #d4dadd;
}
#nav a,
#nav a:hover {
display: block;
line-height: 1.3em;
text-decoration: none;
padding: 10px;
text-align: center
}
#nav span {
display: block;
cursor: pointer
}
#nav li ul span {
white-space: normal;
}
#nav ul li.parent a {} #nav ul li.parent li a {
background-image: none;
}
#nav a.category span {
background: url(../images/nav-category.gif) no-repeat center right;
padding-right: 20px;
}
/* 0 Level */
#nav li.active a {
color: #2882ce;
}
#nav a {
font-size: 115%;
color: #303030;
}
#nav li.last a {
padding-right: 0px !important;
}
#nav li.over a,
#nav a:hover {
color: #2882ce;
}
/* 1st Level */
#nav ul li,
#nav ul li.active {
float: none;
margin: 0;
padding-bottom: 1px;
background: #ecf3f6;
}
#nav ul li.last {
background: #ecf3f6;
padding-bottom: 0;
}
#nav ul a,
#nav ul a:hover {
float: none;
padding: 0;
background: none;
}
#nav ul li a {
font-size: 100% !important;
font-weight: normal !important;
}
/* 2nd Level */
#nav ul,
#nav div {
position: absolute;
width: 15em;
top: 27px;
left: -10000px;
border: 1px solid #899ba5;
}
#nav div ul {
position: static;
width: auto;
border: none;
}
/* 3rd+ Level */
#nav ul ul,
#nav ul div {
top: 5px;
}
#nav ul li a {
background: #ecf3f6;
}
#nav ul li a:hover {
background: #d5e4eb;
}
#nav ul li a,
#nav ul li a:hover {
color: #2f2f2f !important;
}
#nav ul span,
#nav ul li.last li span {
padding: 3px 15px 4px 15px;
}
/* Show menu */
#nav li ul.shown-sub,
#nav li div.shown-sub {
left: 0;
z-index: 999;
}
#nav li .shown-sub ul.shown-sub,
#nav li .shown-sub li div.shown-sub {
left: 100px;
}
<div class="nav-container clearfix">
<ul id="nav">
<li class="first"><span>Home</span>
</li>
<li>whysoy<span>Why Soy?</span>
</li>
<li>plantatree<span>Candle Sold, Tree Planted</span>
</li>
<li><span>Build-a-Candle</span>
</li>
<li><span>Contact Us</span>
</li>
<li><a class="category" href=""><span>Buy Products</span>
<ul class="level0">
</ul>
</a>
</li>
</ul>
</div>
UPDATE #3 (with new info from OP)
in order to achieve what you want, just make this changes below on your CSS:
.nav-container {
background: none repeat scroll 0 0 #d4dadd !important;
box-shadow: 10px 10px 5px #888888 !important;
float: left;
font-size: 0;
font-weight: bold;
margin: 10px 0;
text-align: center;
text-transform: uppercase;
width: 100%;
}
#nav li {
border-right: 1px solid #000;
display: inline-block;
font-size: 12px;
height: 50px;
list-style: none outside none;
margin: 5px 0;
padding: 5px;
position: relative;
vertical-align: top;
width: 15%;
}
#nav ul li, #nav ul li.active {
background: none repeat scroll 0 0 #d4dadd;
border-right: 0 none;
display: block;
float: none;
margin: 0;
width: 100%;
}
/*you may delete this:
#nav ul li.last {
}*/

CSS menu with 3 nested lists - align left problems

I have a navigation menu with 3 sub levels. I need the 3rd level list to align left but I can't get it to behave. I can get levels 2 and 3 to align relatively with the main menu but I want the 2nd level to align relatively and the 3rd level aligning completely to the left. I'd appreciate any help/advice going, here is what I have:
JSFIDDLE HERE
HTML:
<ul class="nav">
<li>LINK1</li>
<li>LINK2
<ul class="#">
<li>LINK2a
<ul class="#">
<li>LINK2b</li>
<li>LINK2c</li>
<li>LINK2d</li>
<li>LINK2e</li>
<li>LINK2f</li>
</ul>
</li>
</ul>
</li>
<li>LINK3</li>
<li>LINK4</li>
<li>LINK5</li>
</ul>
CSS:
a, img { border:none; }
* { margin:0; padding:0; }
.nav{
display:block;
list-style:none;
text-align: left;
position: relative;
height: 30px;
}
.nav li {
display: block;
position: relative;
float: left;
border: 1px solid #FFF;
}
.nav li a {
width: 125px;
height: 30px;
display: table-cell;
vertical-align: middle;
text-decoration: none;
font-size: 12px;
font-family: Arial, Verdana, Helvetica, sans-serif;
text-align: center;
color: #000;
z-index: 2000;
background-color: #999;
}
li.active {
background-color: #999 ;
color: #000;
}
.nav li a:hover {
top: 30px;
}
.nav li:hover > a {
color:#fff;
background-color:#333;
}
.nav li ul {
width: 125px;
height: 25px;
position: absolute;
left: -9999px;
border: 1px solid #FFF;
}
.nav li:hover ul {
left: -2px;
}
.nav li li:hover > a {
color:#000;
background-color:#999;
}
.nav li li{
position: relative;
border: 1px solid #FFF;
height: 25px;
}
.nav li li a {
height: 25px;
top: 25px;
text-decoration: none;
font-size: 9px;
font-family: Arial, Verdana, Helvetica, sans-serif;
text-align: center;
display: table-cell;
vertical-align: middle;
color: #000;
z-index: 2000;
background-color: #999;
}
li li.active {
background-color: #a9d9d9 ;
color: #007f7b;
}
.nav li li:hover ul {
left: -2px;
top: 25px;
}
ul.nav li > ul {
width: 700px;
height: 25px;
background-color:blue;
}
ul.nav li > ul > li > ul {
background-color:red;
height: 25px;
}
ul.nav li > ul > li { display: none; }
ul.nav li:hover li { display: block; }
Well, you are missing some simple changes CSS to make it work properly. I'll post what changes I made here to make it work:
.nav li ul became .nav li > ul
.nav li:hover ul became .nav > li:hover > ul
.nav li li:hover ul became .nav li > li:hover ul
ul.nav li > ul > li { display: none; } became ul.nav li ul ul { display: none; }
ul.nav li:hover li { display: block; } became ul.nav li:hover > ul { display: block; }
Added:
ul.nav li ul ul {
position: absolute;
top:25px;
left: -129px;
}
ul.nav li li:hover > a {
color: white;
background-color: #333
}