HTML List Vertical Organization - html

JSFiddle: http://jsfiddle.net/oj1vrjzh/12/
I'm trying to create a dropdown navbar that will first show sections, then display subsections once hovered on, all controlled by jquery. In the JSFiddle currently shown, the submenu covers the super sections:
<ul class="dropdown">
<li id="menu1" class="nav_menu">
Menu1
</li>
<ul class="submenu">
<li>ASDF</li> <!-- These cover up 'Menu2' -->
<li>ASDF</li>
<li>ASDF</li>
</ul>
<li id="menu2" class="nav_menu">
Menu2
</li>
</ul>
How do I change is so that when the submenu class is displayed, that it will bump the "nav_menu" classes down to the bottom of the submenu class?

I would suggest to try this one i adjusted for you:
Just simple and awesome!
Check this out live at codepen here!
Implementation:
HTML
<nav class="nav">
<ul>
<li>
Home
<ul>
<li>Sub Menu 1
<ul>
<li>Level 3 Menu 1
<ul>
<li>Level 4 Item 1</li>
<li>Level 4 Item 2</li>
</ul>
</li>
<li>Level 3 Menu 2</li>
</ul>
</li>
<li>Sub Menu 2</li>
<li>Sub Menu 3</li>
</ul>
</li>
</ul>
</nav>
CSS
$brand-primary: #fff;;
$text-color: grey;
nav {
font-family: Arial, sans-serif;
font-size: 18px;
line-height: 24px;
background: $brand-primary;
color: $text-color;
> ul {
list-style: none;
> li {
display: inline-block;
}
}
li {
position: relative;
&:hover {
background: mix(#000000, $brand-primary, 20%);
}
li:hover > a {
background: mix(#000000, $brand-primary, 30%);
}
}
a {
display: block;
padding: 10px 20px;
color: inherit;
text-decoration: none;
#include transition(all 0.3s);
}
// Submenu
.has-subnav {
> a {
padding-right: 30px;
position: relative;
&:after {
content: "ยท";
display: block;
font-family: sans;
font-size: 36px;
line-height: 0;
position: absolute;
right: 5px;
margin-right: 2px;
top: 22px;
}
}
}
ul ul {
width: 240px;
background: mix(#000000, $brand-primary, 20%);
position: absolute;
left: 0;
top: 100%;
ul {
left: 100%;
top: 0;
#include box-shadow(-1px 0 4px rgba(0,0,0,0.2));
}
}
// fade effect with css3
li {
& > ul {
visibility:hidden;
opacity:0;
#include transition(visibility 0s linear 0.1s, opacity 0.1s linear);
}
&.active {
> a {
}
& > ul{
visibility:visible;
opacity:1;
#include transition-delay(0s);
#include transition-duration(0.3s);
}
}
}
}
JAVASCRIPT
// navigation
$('.nav li:has(ul)')
.addClass('has-subnav')
.each(function(){
var $li = $(this)
, $a = $('> a', $li);
$a.on('mouseenter', function(){
$li.addClass('active');
});
$li.on('mouseleave', function(){
$li.removeClass('active');
});
});

Related

How to overflow 3 levels deep menu ul > li > ul > li > ul > li

I need to create a menu using a combination of ul > li > ul which scale horizontally. Each ul should have a max-height and to scroll if it overflows. On hover over li, it should open another menu on the right if if has another ul tag inside.
In other words, each subsequent menu should be independent, to have it's own scroll bar if necessary and to show/hide if it has another menu (this part works from js code)
For this example bellow I ignored hover mechanism, but red background should show the flow of displaying next menu levels.
Problem: I can't position 3rd level to be absolute, it wraps under 2nd level. Also, I cant overflow 2nd level so I could have 2 scrolls for level2 and level3.
Thanks for any help.
HTML:
ul.l1--menu,
ul.l2--menu,
ul.l3--menu {
position: relative;
display: block;
padding: 0;
float: left;
z-index: 1;
width: 100px;
border: 1px solid black;
height: 100px;
}
.menu {
position: absolute;
}
li {
list-style: none;
display: block;
}
li:hover {
background: red;
}
ul.l1--menu {
width: 300px;
z-index: 1;
}
ul.l2--menu {
margin : 0;
left: 100px;
width: 200px;
z-index: 2;
position: absolute;
top: 0;
max-height:100px;
overflow-y: scroll;
overflow-x: hidden;
}
ul.l3--menu {
margin : 0;
left: 100px;
width: 100px;
z-index: 3;
position: absolute;
top: 0;
}
<div class="menu">
<ul class=" l1--menu">
<li>
1
</li>
<li>
2
<ul class=" l2--menu">
<li>
a
</li>
<li>
b
</li>
<li>
c
</li>
<li>
d
<ul class=" l3--menu">
<li>
sub d
</li>
</ul>
</li>
<li>
e
<ul class=" l3--menu">
<li>
sub e
</li>
</ul>
</li>
<li>
e
</li>
<li>
f
</li>
<li>
g
</li>
<li>
h
</li>
</ul>
</li>
</ul>
</div>
Here is a solution using pure CSS.
I changed display none to opacity 0 to get the posibility of fade-in fade-out and also to be more user-frindly with keeping the state when going from parent to child
.menu {
position: relative;
}
ul {
width: 200px;
margin: 0;
color: black;
list-style:none;
padding:0;
max-height:100px;
overflow-x: hidden;
overflow-y: auto;
}
li {
padding:0.5em;
}
li:hover{
background-color:blue;
color:white;
}
li .menu {
position: absolute;
z-index: 10;
background-color:lightgrey;
opacity: 0;
transition: opacity 0.5s;
}
li:hover > .menu,
.menu:hover {
opacity: 1;
}
li.parent {
cursor: pointer;
}
.level2 {
top: 0px;
left: 200px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="menu">
<ul>
<li>Link1</li>
<li class="parent">Link3...
<div class="menu level2">
<ul>
<li class="parent">Link31...
<div class="menu level2">
<ul>
<li>Link 311</li>
<li>Link 312</li>
<li>Link 313</li>
<li>Link 314</li>
</ul>
</div>
</li>
<li>Link 32</li>
<li>Link 33</li>
<li>Link 34</li>
</ul>
</div>
</li>
<li>Link2</li>
<li>Link1</li>
<li>Link2</li>
</ul>
</div>
If you wanted to do something similar to this, just try it.
$(function() {
$('li.parent').on('mouseover', function() {
var menuItem = $(this);
var submenuItem = $('.menu', menuItem);
var menuItemPos = menuItem.position();
submenuItem.css({
top: 0,
left: menuItemPos.left + Math.round(menuItem.outerWidth())
});
});
});
.menu {
position: relative;
}
ul {
width: 200px;
margin: 0;
color: black;
list-style:none;
padding:0;
max-height:100px;
overflow-x: hidden;
overflow-y: auto;
}
li {
padding:0.5em;
}
li:hover{
background-color:blue;
color:white;
}
li .menu {
position: absolute;
z-index: 10;
display: none;
background-color:lightgrey;
}
li:hover > .menu {
display: block;
}
li.parent {
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="menu">
<ul>
<li>Link1</li>
<li class="parent">Link3...
<div class="menu">
<ul>
<li class="parent">Link31...
<div class="menu">
<ul>
<li>Link 311</li>
<li>Link 312</li>
<li>Link 313</li>
<li>Link 314</li>
</ul>
</div>
</li>
<li>Link 32</li>
<li>Link 33</li>
<li>Link 34</li>
</ul>
</div>
</li>
<li>Link2</li>
<li>Link1</li>
<li>Link2</li>
</ul>
</div>

CSS for long (scrolling) dropdown menu

I'm trying to create a nested dropdown menu that may potentially be very long and overflow off the page.
What I'd like to do is, when the menu is too long it will display a scroll bar. I'm doing this with overflow: auto. However, when I do this, it traps any submenus within the same 'scroll space' as defined by the first scroll bar.
I've also tried various iterations of overflow: none with the :not(:hover) selector, but nothing I've tried seems to work.
What I'd like it to do is show the scrollbar on each level, only if necessary (i.e. that submenu would scroll off the page). Each submenu should 'pop' out of the previous scroll bar, if any, as if it was not there.
I'd like to do this in all CSS, but I'm open to a JS solution as well.
I have a code pen showing the issue here:
https://codepen.io/mcmurphy510/pen/ZyGLKd
I'm not sure if I'm understanding your question correctly, but try isolating your desired element by using ID or CLASS. See the third level menu.
#primary_nav_wrap {
margin-top: 15px
}
#primary_nav_wrap ul {
list-style: none;
position: relative;
float: left;
margin: 0;
padding: 0;
}
#primary_nav_wrap ul a {
display: block;
color: #333;
text-decoration: none;
font-weight: 700;
font-size: 12px;
line-height: 32px;
padding: 0 15px;
font-family: "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif
}
#primary_nav_wrap ul li {
position: relative;
float: left;
margin: 0;
padding: 0;
}
#primary_nav_wrap ul li.current-menu-item {
background: #ddd
}
#primary_nav_wrap ul li:hover {
background: #f6f6f6
}
#primary_nav_wrap ul ul {
display: none;
position: absolute;
top: 100%;
left: 0;
background: #fff;
padding: 0;
}
#primary_nav_wrap ul ul li {
float: none;
width: 200px
}
#primary_nav_wrap ul ul a {
line-height: 120%;
padding: 10px 15px
}
#primary_nav_wrap ul ul ul {
top: 0;
left: 100%
}
#primary_nav_wrap ul li:hover > ul {
display: block;
height: 200px;
}
#primary_nav_wrap ul li ul li:not(:hover) {
}
/* ul li ul li ul li {
overflow: auto;
} */
#subdeep {
overflow: auto;
height: 50px !important;
}
<h1>Simple Pure CSS Drop Down Menu</h1>
<nav id="primary_nav_wrap">
<ul>
<li>Menu 1
<ul>
<li>Sub Menu 1</li>
<li>Sub Menu 2</li>
<li>Sub Menu 3</li>
<li>Sub Menu 4
<ul>
<li>Deep Menu 1
<ul id="subdeep">
<li>Sub Deep 1</li>
<li>Sub Deep 2</li>
<li>Sub Deep 3</li>
<li>Sub Deep 4</li>
</ul>
</li>
<li>Deep Menu 2</li>
</ul>
</li>
<li>Sub Menu 5</li>
</ul>
</li>
</ul>
</nav>
Probably you could use the proposed solution as the elements are positioned relative to each other and therefore the menu can set up some branches, you would "just" require to ensure that the parent element(s) remain visible
Mouse over on item "Link 3" will shows its sub-menu on the right side of it and then mouse over on "Link 31" for further sub menu.
.menu {
position: relative;
}
ul {
width: 200px;
margin: 0;
color: black;
list-style:none;
padding:0;
max-height:100px;
overflow-x: hidden;
overflow-y: auto;
}
li {
padding:0.5em;
}
li:hover{
background-color:blue;
color:white;
}
li .menu {
position: absolute;
z-index: 10;
background-color:lightgrey;
opacity: 0;
transition: opacity 0.5s;
}
li:hover > .menu,
.menu:hover {
opacity: 1;
}
li.parent {
cursor: pointer;
}
.level2 {
top: 0px;
left: 200px;
}
<div class="menu">
<ul>
<li>Link1</li>
<li class="parent">Link3...
<div class="menu level2">
<ul>
<li class="parent">Link31...
<div class="menu level2">
<ul>
<li>Link 311</li>
<li>Link 312</li>
<li>Link 313</li>
<li>Link 314</li>
</ul>
</div>
</li>
<li>Link 32</li>
<li>Link 33</li>
<li>Link 34</li>
</ul>
</div>
</li>
<li>Link2</li>
<li>Link1</li>
<li>Link2</li>
</ul>
</div>

Gap Between dropdown menu and sub menu

I'd like for the menu sub menu to show 10 pixels underneath the menu, i can achieve that using margin-top on the ul, but then i cant move my mouse down to the sub menu because there is a gap. There are posts very similar to this but i could't extract an answer from them. Like this one
Space between menu and drop down menu
deepMenu {
background: black !important;
margin-left: 100px !important;
position: absolute !important;
}
.lmao li ul {
display: none;
position: absolute;
border-top: 5px solid black;
margin-top: 18px;
}
.lmao li ul li {
display: none;
border-top: 0.1px solid #F2F2F2;
padding: 10px 40px 10px 10px;
margin: 0;
position: relative;
z-index: 9999999;
background: white;
font-size: 8pt;
line-height: 24px;
text-align: left;
}
.lmao li:hover > ul,
.lmao li:hover > ul li {
display: block;
}
<ul class="lmao">
<li class="point1">home
<ul>
<li>Sub Menu 1</li>
<li>Sub Menu 2 long lel</li>
<li>Sub Menu 3 really bare long mad</li>
<li>Sub Menu 4 dvg</li>
</ul>
<li class="point">features
<ul>
<li>sdfgsdfgsdfgsdfgsdfgsdfg</li>
<li>sdfg</li>
<li>sdfgsdfgsdfgsdfg</li>
<li>sdfgsdfgsdfgsdfgsdfg</li>
</ul>
<li class="point layout">Layouts
<ul>
<li>sfdgsdfgsdfgsdfgsdfgdfgsdgsdf</li>
<li>sfdgsdfgsdfgl</li>
<li>dfsgsdfgsdfgsdfgsdfgsdfgsdfg</li>
<li class="arrow">sfgsdfg
<ul class="deepMenu">
<li>Deep Menu 1
<ul>
<li>Sub Deep 1</li>
<li>Sub Deep 2</li>
<li>Sub Deep 3</li>
<li>Sub Deep 4</li>
</ul>
</li>
<li>Deep Menu 2</li>
</ul>
</li>
</ul>
</li>
<li class="point">pages</li>
<li class="point">light version</li>
</ul>
UPDATE:
Now that you gave the reference, the hover menu is not actually distant from the li itself, but it is positioned right below it. On the example site the li has a height bigger than the text within and has position: relative; on it.
The dropdown is absolute positioned right below this bigger <li> element with a top: 100%; that way it is distant from the text that triggers the dropdown.
Check the updated Snippet bellow with an updated solution.
Margins are not 'hoverable', and therefore the hover selector is not triggered. One way to keep it distant whilst 'hoverable' is to use padding instead of margins.
So you could change your .lmao li ul, although I wouldn't advise adding style to tags as a CSS best practice, I usually adopt a CSS naming convention such as BEM, SMACSS, among others.
/* Reset the ul style */
ul {
list-style: none;
padding: 0;
margin: 0;
}
deepMenu {
background: black !important;
margin-left: 100px !important;
position: absolute !important;
}
.lmao {
width: 100%;
text-align: center;
}
.lmao li {
display: inline-block;
background-color: white;
padding: 15px;
position: relative;
padding: 20px;
}
.lmao li a {
text-decoration: none;
color: black;
}
.lmao li a:hover {
text-decoration: none;
color: #f38763;
}
.lmao li ul {
display: none;
position: absolute;
border-top: 5px solid black;
top: 100%;
min-width: 200px;
}
.lmao li ul li {
display: none;
border-top: 0.1px solid #F2F2F2;
padding: 10px 40px 10px 10px;
margin: 0;
position: relative;
z-index: 9999999;
background: white;
font-size: 8pt;
line-height: 24px;
text-align: left;
}
.lmao li:hover > ul,
.lmao li:hover > ul li {
display: block;
}
<ul class="lmao">
<li class="point1">home
<ul>
<li>Sub Menu 1
</li>
<li>Sub Menu 2 long lel
</li>
<li>Sub Menu 3 really bare long mad
</li>
<li>Sub Menu 4 dvg
</li>
</ul>
<li class="point">features
<ul>
<li>sdfgsdfgsdfgsdfgsdfgsdfg
</li>
<li>sdfg
</li>
<li>sdfgsdfgsdfgsdfg
</li>
<li>sdfgsdfgsdfgsdfgsdfg
</li>
</ul>
<li class="point layout">Layouts
<ul>
<li>sfdgsdfgsdfgsdfgsdfgdfgsdgsdf
</li>
<li>sfdgsdfgsdfgl
</li>
<li>dfsgsdfgsdfgsdfgsdfgsdfgsdfg
</li>
<li class="arrow">sfgsdfg
<ul class="deepMenu">
<li>Deep Menu 1
<ul>
<li>Sub Deep 1
</li>
<li>Sub Deep 2
</li>
<li>Sub Deep 3
</li>
<li>Sub Deep 4
</li>
</ul>
</li>
<li>Deep Menu 2
</li>
</ul>
</li>
</ul>
</li>
<li class="point">pages
</li>
<li class="point">light version
</li>
</ul>
body {
background-color: #cac3bc
}
nav {
float: left;
}
nav ul ul {
display: none;
}
nav ul li:hover > ul {
display: block;
}
nav ul {
background-color: #fff;
margin-top: 10px;
padding: 0 20px;
list-style: none;
position: relative;
display: inline-table;
margin-right: -80px;
}
nav ul li {
float: left;
}
nav ul li:hover {
border-bottom: 5px solid #f5aa65;
color: #fff;
}
nav ul li a:hover {
color: #000;
}
nav ul li a {
display: block;
padding: 15px 15px;
font-family: 'PT Sans', sans-serif;
color: #000;
text-decoration: none;
}
nav ul ul {
background-color:#fff;
border-radius: 0px;
padding: 0;
position: absolute;
top: 100%;
box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
}
nav ul ul li {
float: none;
position: relative;
}
nav ul ul li a {
padding: 15px 40px;
color: #000;
}
nav ul ul:before {
content: "";
display: block;
height: 20px;
position: absolute;
top: -20px;
width: 100%;
}
<body>
<nav>
<ul>
<li>One
<ul>
<li>A</li>
<li>B
</ul>
</li>
<li>Two
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
</ul>
</li>
<li>Three
<ul>
<li>A</li>
<li>B</li>
</ul>
</li>
<li>Four</li>
</ul>
</nav>
</body>

How can i add a sub-sub menu with CSS

Im trying to do a sub-sub menu in a webpage. I tried following the help in this post: how do I make a sub sub menu with css? but to be honest i didnt understand what code i had to add in each class and when i tried it didnt show anything. Here is the code of the menu:
<div class="l7menu">
<ul class="dpdown">
<li class="mainlist">Hombres
<ul class="sub_menu">
Prueba
Here goes the sub-submenu
<ul>
<li> Item 1 </li>
<li> Item 2 </li>
</ul>
</ul>
</li>
</ul>
</div>
Also the CSS of the classes are these ones (The sub_menu and l7menu class dont have any style applied):
.mainlist {
border-bottom: 2px solid #EAD704;
background: none;
margin-left: 2px !important;
}
.mainlist:hover {
color: #EAD704 !important;
}
ul.dpdown {
float: right;
position: relative;
z-index: 1000;
}
ul.dpdown li {
font-weight: bold;
float: left;
zoom: 1;
display: inline;
line-height: 20px;
list-style: none outside none;
margin-left: -25px;
}
ul.dpdown a:hover {
color: #EAD704;
}
ul.dpdown a:active {
color: #FFFFFF;
}
ul.dpdown li a {
color: #e8e8e8;
display: block;
padding-bottom: 4px;
text-align: center;
width: 150px;
}
ul.dpdown li:last-child a {
border-right: none;
} /* Doesn't work in IE */
ul.dpdown li.hover, ul.dpdown li:hover {
color: black;
position: relative;
}
ul.dpdown li.hover a {
color: white;
}
/*
LEVEL TWO
*/
ul.dpdown ul {
width: 150px;
visibility: hidden;
position: absolute;
top: 100%;
left: 0;
}
ul.dpdown ul li {
font-weight: normal;
background: #333;
color: #000;
float: none;
}
/* IE 6 & 7 Needs Inline Block */
ul.dpdown ul li a {
background-color: #101010;
border-right: medium none;
display: inline-block;
margin-top: 2px;
padding: 10px 0;
width: 150px;
font-size: 13px;
color: #999999;
}
ul.dpdown ul li a:hover {
background-color: #222222;
}
/*
LEVEL THREE
*/
ul.dpdown ul ul {
left: 100%;
top: 0;
}
ul.dpdown li:hover > ul {
visibility: visible;
}
As always thank you very very much !
Here's a FIDDLE, I fixed your CSS a little.
Your HTML should look like this
<div class="l7menu">
<ul class="dpdown">
<li class="mainlist">Hombres
<ul class="sub_menu">
<li>Prueba</li>
<li>Here goes the sub-submenu
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
</li>
</ul>
</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>

Overlapping of li element's text when nested

I am trying to create a menu bar with CSS/HTML which on hover would trigger in the list elements. I am having an issue when I am trying to arrange the list in two columns.
Here is the sample code:http://jsfiddle.net/Km922/1/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Experiment</title>
<style media="all">
.navigation ul
{
margin: 0px;
padding: 0px;
list-style: none;
left: 300px;
position: relative;
top: 200px;
}
.navigation ul li ul .second
{
float: right;
width: 200px;
position: relative;
overflow: hidden;
}
.navigation li
{
float: left;
height: 30px;
margin-left: 15px;
margin-right: 15px;
position: relative;
top: 30px; /*clear:left;*/
}
.navigation li a
{
text-decoration: none;
}
.navigation li a:hover
{
text-decoration: underline;
}
.navigation li ul
{
margin: 0px;
padding: 0px;
position: absolute;
left: -9999px;
height: 30px;
top: 30px; /*display:inline-block;*/
}
.navigation li:hover ul
{
left: 0;
width: 160px;
visibility: visible;
}
.header-container
{
background: url(Images/nav-bg4.png) repeat-x scroll 0 0 transparent;
height: 136px;
left: 0;
position: absolute;
right: 0;
top: 0;
z-index: 901;
}
#apDiv1
{
position: absolute;
width: 200px;
height: 115px;
z-index: 902;
top: 29px;
}
.navigation ul li ul .first
{
float: left;
width: 200px;
position: absolute;
overflow: hidden;
}
</style>
</head>
<body background="Images/global-splash-map.jpg">
<header class="header-container">
<div id="apDiv1"><img src="Images/levis-logo.png" /></div>
</header>
<div class="navigation">
<ul>
<li>menu1
<ul>
<li class="second">Canada</li>
<li class="first">United States</li>
<li class="second">Mexico</li>
</ul>
</li>
<li>menu2
<ul>
<li class="second">Argentina</li>
<li class="second">Brazil</li>
<li class="second">Bolivia</li>
<li class="second">Chile</li>
<li class="second">Colombia</li>
<li class="second">Ecuador</li>
<li class="first">Panama</li>
<li class="first">Paraguay</li>
<li class="first">Peru</li>
<li class="first">Uruguay</li>
<li class="first">Venezuela</li>
</ul>
</li>
<li>menu3
<ul>
<li>sub menu item 1</li>
<li>sub menu item 2</li>
<li>sub menu item 3</li>
<li>sub menu item 4</li>
</ul>
</li>
<li>menu3
<ul>
<li>sub menu item 1</li>
<li>sub menu item 2</li>
<li>sub menu item 3</li>
<li>sub menu item 4</li>
</ul>
</li>
<li>menu4
<ul>
<li>sub menu item 1</li>
<li>sub menu item 2</li>
<li>sub menu item 3</li>
<li>sub menu item 4</li>
</ul>
</li>
</ul>
</div>
</body>
</html>
When you hover on menu1 , it displays perfectly but when you hover on menu2, I see the list elements which are supposed to appear in each single line are appearing and overlapping with each other. Can anyone help me in fixing this issue?
You have several problems. First, floats and absolute positioning aren't compatible:
.navigation ul li ul .first {
float: left;
position: absolute;
}
Next, you can't stack list items like this and have them split into two columns. That's not how floats work.
<ul>
<li class="second">Argentina</li>
<li class="second">Brazil</li>
<li class="second">Bolivia</li>
<li class="second">Chile</li>
<li class="second">Colombia</li>
<li class="second">Ecuador</li>
<li class="first">Panama</li>
<li class="first">Paraguay</li>
<li class="first">Peru</li>
<li class="first">Uruguay</li>
<li class="first">Venezuela</li>
</ul>
Multi-column lists without specific HTML is a challenge. Here's an article that might get you started: http://alistapart.com/article/multicolumnlists
As already noted, you cannot use float and absolute positioning together on the same element. That's ok, because we don't want either one. The secret to getting perfect columns is to use the CSS columns module.
I've done a considerable amount of cleanup here in your CSS:
http://jsfiddle.net/uPzxb/4/ (prefixes not included)
.navigation ul {
margin: 0px;
padding: 0px;
list-style: none;
left: 30px;
position: relative;
top: 20px;
}
.navigation > ul > li {
float: left;
height: 30px;
margin-left: 15px;
margin-right: 15px;
position: relative;
}
.navigation li a {
text-decoration: none;
}
.navigation li a:hover {
text-decoration: underline;
}
.navigation li ul {
margin: 0px;
padding: 0px;
position: absolute;
top: 30px;
display: none;
}
.navigation li:hover ul {
left: 0;
width: 160px;
display: block;
columns: 2; /* this here is the key */
}
.header-container {
background: url(Images/nav-bg4.png) repeat-x scroll 0 0 transparent;
height: 136px;
left: 0;
position: absolute;
right: 0;
top: 0;
z-index: 901;
}
#apDiv1 {
position: absolute;
width: 200px;
height: 115px;
z-index: 902;
top: 29px;
}
http://caniuse.com/#feat=multicolumn
For elements that will change position, like dropdown list items. It's probably better to change list items from absolute to relative positioning.
position: relative;