In my application there is a breadcrumbs under the menu :
At runtime when I pass the mouse above a submenu then the submenu disappears. Here is codes :
<div id="divmenuppal"> // this the menu
<ul class="dropdown">
<li class="menuppal">Administration
<ul>
<li>Artificial Turf</li>
<li>
Batting Cages
<ul>
<li>Indoor
<ul>
<li>Garden</li>
</ul>
</li>
<li>Outdoor</li>
</ul>
</li>
<li>Benches & Bleachers</li>
<li>Communication Devices</li>
<li>Dugouts</li>
<li>Fencing & Windscreen</li>
<li><hr></li>
<li>Floor Protectors</li>
<li>Foul Poles</li>
<li>Netting</li>
<li>Outdoor Furniture</li>
<li>Outdoor Signs</li>
<li><hr></li>
<li>Padding</li>
<li>Scoreboards</li>
<li>Shade Structures</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Structure
<ul>
<li>All-in-One Team Cart</li>
<li>Air & Electrical Reels</li>
<li>Field Drags</li>
<li>
Field Marking Equipment
<ul>
<li>Batter's Box Templates</li>
<li>Dryline Markers</li>
<li>Field Paint
<ul>
<li>Garden</li>
</ul>
</li>
<li>Field Sprayers</li>
<li>Stencils</li>
</ul>
</li>
<li>
Field Tarps
<ul>
<li>Area Tarps</li>
<li>Growth Covers / Protectors</li>
<li>Infield Tarps</li>
<li>Tarp Accessories</li>
</ul>
</li>
<li>Hand Tools</li>
<li>
Irrigation, Hoses, Nozzles
<ul>
<li>Hoses & Hose Reels</li>
<li>Irrigation</li>
<li>Nozzles</li>
</ul>
</li>
<li>Layout Tools</li>
<li>Moisture Removal</li>
<li><hr></li>
<li>Mound Fortification</li>
<li>Mowers & Stripers</li>
<li>Soil Management</li>
<li>Soil Amendments</li>
<li>Spreaders & Sweepers</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Exercice
<ul>
<li>
Baseball - Softball
<ul>
<li>Base Accessories</li>
<li>Bases & Home Plates</li>
<li>Game Accessories</li>
<li>Pitching Rubbers</li>
</ul>
</li>
<li>
Batting Practice Equipment
<ul>
<li>Backstops</li>
<li>Infield Screens</li>
<li>Jugs Pitching Machines</li>
<li>Turf Mats</li>
<li>Turf Protectors</li>
<li>Replacement Accessories</li>
</ul>
</li>
<li>
Batting Cages
<ul>
<li>Indoor</li>
<li>Outdoor</li>
</ul>
</li>
<li>
Portable Mounds
<ul>
<li>Batting Practice Mounds</li>
<li>Game Mounds</li>
<li>Practice Mounds</li>
</ul>
</li>
<li>
Football
<ul>
<li>First Down Markers</li>
<li>Football Accessories</li>
<li>Football Goalposts</li>
</ul>
</li>
<li>
Soccer
<ul>
<li>Soccer Goals</li>
<li>Soccer Accessories</li>
</ul>
</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Contribuables et biens
<ul>
<li>Ladders & Sticks</li>
<li>Hurdles</li>
<li>Training Accessories</li>
<li>Smart-Cart Training System</li>
<li>Smart-Hurdle Collection</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Recettes
<ul>
<li>Field Design</li>
<li>Turf Management</li>
<li>Training</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Edition
<ul>
<li>Field Design</li>
<li>Turf Management</li>
<li>Training</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Outils
<ul>
<li>Field Design</li>
<li>Turf Management</li>
<li>Training</li>
<li> - VIEW ALL - </li>
</ul>
</li>
</ul>
</div>
<div class="breadcrumbs" style="clear:left;"> // this is the breadcrumbs
<div class="container-fluid">
<ul class="bread">
<li>Accueil</li><li>Gestion des contribuables</li><li><a>Fiche d'un contribuable</a></li>
</ul>
<ul class="bread pull-right">
<li style="color: #000;padding: 5px;font-size: 11px;font-weight: bold;">Fiche d'un contribuable</li>
</ul>
</div>
</div>
The css of the menu :
* {
margin: 0;
padding: 0;
}
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
}
a {
text-decoration: none;
font-size: 11px;
font-weight: 100;
width: 100%;
box-sizing: border-box;
}
ul {
list-style: none;
}
ul.dropdown ul {
width: 220px;
visibility: hidden;
position: absolute;
background-color: #40617C;
}
ul.dropdown li:not(.menuppal):not(:first-child):not(:last-child)
{
margin-top: 8px;
margin-bottom: 8px;
}
hr {
margin-left: 6px;
margin-right: 8px;
border-top: 0;
}
/*
LEVEL ONE : MAIN MENU
*/
ul.dropdown {
position: relative;
}
ul.dropdown li.menuppal {
float: left;
zoom: 1;
background: #000 url(../images/menuLight.png) repeat-x top left;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-left: 1px solid #222;
}
ul.dropdown li.menuppal a {
display: block;
padding: 4px 8px;
color: #000000;
}
/* Doesn't work in IE */
ul.dropdown li.menuppal:hover {
background: #ccc url('../images/menuDark.png') repeat-x 50% 50%;
position: relative;
}
/*
FIN LEVEL ONE
*/
/*
LEVEL TWO
*/
ul.dropdown ul {
top: 100%;
left: 0;
}
ul.dropdown ul li {
float: none;
position: relative;
}
/* IE 6 & 7 Needs Inline Block */
ul.dropdown li.menuppal ul li a {
border-right: none;
color: #FFF;
display: inline-block;
}
ul.dropdown li.menuppal ul li a:hover {
background: #07243a;
}
ul.dropdown li.menuppal ul li a:visited {
word-break: break-all;
}
/*
LEVEL THREE
*/
ul.dropdown ul ul {
left: 100%;
top:0!important;
}
/*
LEVEL FOUR
*/
ul.dropdown ul ul ul {
left: 100%;
top:0!important;
}
ul.dropdown li:hover > ul {
visibility: visible;
}
So how to make the submenus not disappeared on hover ?
This is working fine.
demo here
enter code here
ok I found it :
ul.dropdown ul {
list-style: none;
margin-left: 0px;
z-index: 2; // this is the trick :)
}
Related
I'm using CSS columns to span menu items across multiple columns, it is working fine for the most part, but my problem is I'm not sure if there is a way to make sure each direct child of the respective parent element with the CSS column code all remains in the same column.
So what I mean is, if the contents of the child appears it will be too long to be contained in the current column, then the whole thing will be moved into the next column, not span the contents across multiple columns.
Example here: https://codepen.io/gutterboy/pen/YzzgqVz
As you can see, Heading 2 and Heading 4 both span multiple columns - is it possible to make sure the contents of each respective sub-menu is all contained in a single column?
I considered using flexbox for this and setting flex-flow: column wrap; as well as a height; but because the area is absolute the width becomes a problem; whilst not viewable in this example, removing the width becomes an issue as the area is too small (the element it is relative to is much smaller, so setting it to 100% doesn't work); leaving it as is means the content can overflow the area quite possibly.
Example HTML:
<div class="wrapper">
<ul class="menu">
<li>
Heading 1
<ul class="sub-menu">
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
</ul>
</li>
<li>
Heading 2
<ul class="sub-menu">
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
</ul>
</li>
<li>
Heading 3
<ul class="sub-menu">
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
</ul>
</li>
<li>
Heading 4
<ul class="sub-menu">
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
</ul>
</li>
<li>
Heading 5
<ul class="sub-menu">
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
</ul>
</li>
</ul>
</div>
Example SCSS:
.wrapper {
position: relative;
padding: 10px 20px;
}
li {
list-style: none;
}
.menu {
position: absolute;
width: 45vw;
columns: 3 130px;
column-gap: 70px;
padding: 20px 25px;
background-color: gray;
}
.menu a {
color: #fff;
}
.menu > li {
padding-top: 10px;
}
.menu > li > a {
font-size: 17px;
font-weight: bold;
text-decoration: none;
}
.menu > li > ul {
padding: 12px 0 0 15px;
}
.menu > li > ul > li {
line-height: 1.4;
}
I'm not totally sure if I got your point, but I guess you want to place each menu in it's own column. You can easily achieve this by using a css grid layout like this:
.wrapper {
padding: 10px 20px;
}
.menu {
display: grid;
grid-template-rows: 1fr;
grid-template-columns: repeat(5, 1fr);
}
li {
list-style: none;
}
.menu {
position: absolute;
columns: 3 130px;
column-gap: 40px;
padding: 20px 25px;
background-color: gray;
}
.menu a {
color: #fff;
}
.menu > li {
padding-top: 10px;
}
.menu > li > a {
font-size: 17px;
font-weight: bold;
text-decoration: none;
}
.menu > li > ul {
padding: 12px 0 0 15px;
}
.menu > li > ul > li {
line-height: 1.4;
}
<div class="wrapper">
<ul class="menu">
<li>
Heading 1
<ul class="sub-menu">
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
</ul>
</li>
<li>
Heading 2
<ul class="sub-menu">
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
</ul>
</li>
<li>
Heading 3
<ul class="sub-menu">
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
</ul>
</li>
<li>
Heading 4
<ul class="sub-menu">
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
</ul>
</li>
<li>
Heading 5
<ul class="sub-menu">
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
<li>
Item
</li>
</ul>
</li>
</ul>
</div>
I want to create a dropdown menu :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Simply Styled jQuery Dropdown</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen, projection"/>
<script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.dropdownPlain.js"></script>
</head>
<body>
<div>
<ul class="dropdown">
<li class="menuppal">Administration
<ul>
<li>Artificial Turf</li>
<li>
Batting Cages
<ul>
<li>Indoor</li>
<li>Outdoor</li>
</ul>
</li>
<li>Benches & Bleachers</li>
<li>Communication Devices</li>
<li>Dugouts</li>
<li>Fencing & Windscreen</li>
<li>Floor Protectors</li>
<li>Foul Poles</li>
<li>Netting</li>
<li>Outdoor Furniture</li>
<li>Outdoor Signs</li>
<li>Padding</li>
<li>Scoreboards</li>
<li>Shade Structures</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Structure
<ul>
<li>All-in-One Team Cart</li>
<li>Air & Electrical Reels</li>
<li>Field Drags</li>
<li>
Field Marking Equipment
<ul>
<li>Batter's Box Templates</li>
<li>Dryline Markers</li>
<li>Field Paint</li>
<li>Field Sprayers</li>
<li>Stencils</li>
</ul>
</li>
<li>
Field Tarps
<ul>
<li>Area Tarps</li>
<li>Growth Covers / Protectors</li>
<li>Infield Tarps</li>
<li>Tarp Accessories</li>
</ul>
</li>
<li>Hand Tools</li>
<li>
Irrigation, Hoses, Nozzles
<ul>
<li>Hoses & Hose Reels</li>
<li>Irrigation</li>
<li>Nozzles</li>
</ul>
</li>
<li>Layout Tools</li>
<li>Moisture Removal</li>
<li>Mound Fortification</li>
<li>Mowers & Stripers</li>
<li>Soil Management</li>
<li>Soil Amendments</li>
<li>Spreaders & Sweepers</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Exercice
<ul>
<li>
Baseball - Softball
<ul>
<li>Base Accessories</li>
<li>Bases & Home Plates</li>
<li>Game Accessories</li>
<li>Pitching Rubbers</li>
</ul>
</li>
<li>
Batting Practice Equipment
<ul>
<li>Backstops</li>
<li>Infield Screens</li>
<li>Jugs Pitching Machines</li>
<li>Turf Mats</li>
<li>Turf Protectors</li>
<li>Replacement Accessories</li>
</ul>
</li>
<li>
Batting Cages
<ul>
<li>Indoor</li>
<li>Outdoor</li>
</ul>
</li>
<li>
Portable Mounds
<ul>
<li>Batting Practice Mounds</li>
<li>Game Mounds</li>
<li>Practice Mounds</li>
</ul>
</li>
<li>
Football
<ul>
<li>First Down Markers</li>
<li>Football Accessories</li>
<li>Football Goalposts</li>
</ul>
</li>
<li>
Soccer
<ul>
<li>Soccer Goals</li>
<li>Soccer Accessories</li>
</ul>
</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Contribuables et biens
<ul>
<li>Ladders & Sticks</li>
<li>Hurdles</li>
<li>Training Accessories</li>
<li>Smart-Cart Training System</li>
<li>Smart-Hurdle Collection</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Recettes
<ul>
<li>Field Design</li>
<li>Turf Management</li>
<li>Training</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Edition
<ul>
<li>Field Design</li>
<li>Turf Management</li>
<li>Training</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Outils
<ul>
<li>Field Design</li>
<li>Turf Management</li>
<li>Training</li>
<li> - VIEW ALL - </li>
</ul>
</li>
</ul>
</div>
</body>
</html>
The css is :
* {
margin: 0;
padding: 0;
}
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
}
a {
text-decoration: none;
font-size: 11px;
font-weight: 100;
width: 100%;
}
ul {
list-style: none;
}
/*
LEVEL ONE : MAIN MENU
*/
ul.dropdown {
position: relative;
}
ul.dropdown li.menuppal {
float: left;
zoom: 1;
background: #000 url(../images/menuLight.png) repeat-x top left;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-left: 1px solid #222;
}
ul.dropdown li.menuppal a {
display: block;
padding: 4px 8px;
color: #000000;
}
/* Doesn't work in IE */
ul.dropdown li.menuppal:hover {
background: #ccc url('../images/menuDark.png') repeat-x 50% 50%;
position: relative;
}
/*
FIN LEVEL ONE
*/
/*
LEVEL TWO
*/
ul.dropdown ul {
width: 220px;
visibility: hidden;
position: absolute;
top: 100%;
left: 0;
background-color: #40617C;
}
ul.dropdown ul li {
float: none;
}
/* IE 6 & 7 Needs Inline Block */
ul.dropdown li.menuppal ul li a {
border-right: none;
color: #FFF;
display: inline-block;
}
ul.dropdown li.menuppal ul li a:hover {
background: #07243a;
}
ul.dropdown li.menuppal ul li a:visited {
word-break: break-all;
}
/*
FIN LEVEL TWO
*/
At runtime there is an extra width at the right of the menu when I pass the mouse over it :
So how to remove this extra ?
You have both width and padding set, so give box-sizing:
a {
text-decoration: none;
font-size: 11px;
font-weight: 100;
width: 100%;
box-sizing: border-box;
}
You have the following styles:
a {
text-decoration: none;
font-size: 11px;
font-weight: 100;
width: 100%;
}
ul.dropdown li.menuppal ul li a {
border-right: none;
color: #FFF;
display: inline-block;
}
ul.dropdown li.menuppal a {
display: block;
padding: 4px 8px;
color: #000000;
}
As you have padding and width:100% it will make your anchor extend beyond 100%. The following will fix it:
ul.dropdown li.menuppal a {
box-sizing:border-box;
}
More information about box-sizing
I want to keep my login and sign up to the right of my webpage. I've tried using float unsuccessfully: how do I implement this?
Here is the html page:
<link href="navigation.css" rel="stylesheet" type="text/css" />
<nav style="position:relative; top:1.5em;">
<ul>
<li>
Home
</li>
</ul>
<ul>
<li>
form
</li>
</ul>
<ul>
<li>
Profile
</li>
</ul>
<ul style="">
<li>
login
</li>
</ul>
<ul>
<li>
Sign up
</li>
</ul>
</nav>
I want to use inline css to float or put my login and sign up to the right without changing my nav alignment.
First off, it is not neccessary to create a <ul> for each navigation item. Instead use logical groupings of the nav items. If a, b and c belong together then use a single <ul> for all those items.
I believe you are attempting to do something like this:
<nav class="cf">
<ul class="left">
<li>Home</li>
<li>Form</li>
<li>Profile</li>
</ul>
<ul class="right">
<li>Login</li>
<li>Sign Up</li>
</ul>
</nav>
// http://nicolasgallagher.com/micro-clearfix-hack/
.cf:before,
.cf:after {
content: " "; /* 1 */
display: table; /* 2 */
}
.cf:after {
clear: both;
}
ul {
margin: 0;
padding: 5px;
}
ul li {
list-style: none;
float: left;
margin: 0 5px;
padding: 3px 8px;
}
.left {
float: left;
background-color: skyblue;
}
.right {
float: right;
background-color: yellow;
}
jsFiddle: http://jsfiddle.net/yddn822v/1/
<ul style="float:right">
<li>login</li>
</ul>
<ul style="float:right">
<li>Sign up</li>
</ul>
this worked for me thnx for help
Okay so here's the deal I made this navigation bar, thanks to a tutorial online, with the code below, everything works BUT the drop down menu, I hover over and nothing happens I've been slaving over this for hours! Thank you very much in advance for anyone's help! I know I'm close to getting it right but I just can't figure it out! Again thank you in advance for your help.
<style>
header { font-family: 'blades_gf_freeregular', Futura, Arial, sans-serif; }
nav { height: 41px; background: linear-gradient( #1e7995, #1c2c3f); }
nav ul { margin: 0; }
nav, ul.submenu { background: linear-gradient( #1e7995, #1c2c3f); border-radius: 5px; padding: 0; }
nav ul li { display: block; width: 150px; text-align: center; float: left; margin: 0; padding: 0; }
nav li:hover { background: rgba(0,0,0,0.4); }
nav a { color:#fff; text-decoration: none; display: block; padding: 10px; }
nav ul.submenu { background: rgba(0,0,0,0.8); position: relative; boredr-radius: 0 0 5px 5px; height: 0px; overflow: hidden; }
nav ul.submenu li { float: none; text-align: left; border-bottom: 1px solid rbga(0,0,0,0.3); }
nav ul li { transition: .3s all linear; }
nav ul li:hover ul.submenu { height: 126px; }
</style>
<header>
<p><img src="assets/images/header32.png" alt="before and after effects title image"/></p>
<nav role="navigation" aria-label="Main menu">
<ul role="menubar">
<li role="menuitem" tabindex="0">Home</li>
<li role="menuitem" aria-haspopup=true tabindex="0">Tutorials</li>
<ul class="submenu" role="menu" aria-hidden=true>
<li role="menuitem" tabindex="-1">Pre-Production</li>
<li role="menuitem" tabindex="-1">Production</li>
<li role="menuitem" tabindex="-1">Post</li>
</ul>
<li role="menuitem" tabindex="0">Films</li>
</ul>
</nav>
</header>
You need to move sub menu ul inside the menu li
<header>
<p><img src="assets/images/header32.png" alt="before and after effects title image"/></p>
<nav role="navigation" aria-label="Main menu">
<ul role="menubar">
<li role="menuitem" tabindex="0">Home</li>
<li role="menuitem" aria-haspopup=true tabindex="0">Tutorials
<ul class="submenu" role="menu" aria-hidden=true>
<li role="menuitem" tabindex="-1">Pre-Production</li>
<li role="menuitem" tabindex="-1">Production</li>
<li role="menuitem" tabindex="-1">Post</li>
</ul>
</li>
<li role="menuitem" tabindex="0">Films</li>
</ul>
</nav>
</header>
DEMO
You have prematurely closed the parent <li> element that the submenu should belong to.
http://jsfiddle.net/GL87s/
<header>
<p><img src="assets/images/header32.png" alt="before and after effects title image"/></p>
<nav role="navigation" aria-label="Main menu">
<ul role="menubar">
<li role="menuitem" tabindex="0">Home</li>
<li role="menuitem" aria-haspopup=true tabindex="0">Tutorials
<ul class="submenu" role="menu" aria-hidden=true>
<li role="menuitem" tabindex="-1">Pre-Production</li>
<li role="menuitem" tabindex="-1">Production</li>
<li role="menuitem" tabindex="-1">Post</li>
</ul></li>
<li role="menuitem" tabindex="0">Films</li>
</ul>
</nav>
</header>
Fixes it.
The only children a <ul> should have is <li>s. Not another <ul>.
You're really close. Judging by your CSS, the ul.submenu should be inside the <li> it belongs to. Just move it inside the <li>. Here's a jsfiddle with the change:
http://jsfiddle.net/8WGKU/
Keep submenu inside <li>
<li role="menuitem" aria-haspopup=true tabindex="0">Tutorials
<ul class="submenu" role="menu" aria-hidden=true>
<li role="menuitem" tabindex="-1">Pre-Production</li>
<li role="menuitem" tabindex="-1">Production</li>
<li role="menuitem" tabindex="-1">Post</li>
</ul>
</li>
Fiddle here.
My Drop Down Menu is Not WORKING! it works on Jsfiddle but not in real life...lol. I'm very new to all fo this. I hope this isn't a stupid question. I tried to find solutions but have not seen one that works the way I want this to.
<!DOCTYPE html>
<html>
<head>
<title>Home - Joe </title>
<link rel="stylesheet" type="text/css" href="home.css"/>
<script src="Home.js" type="text/javascript"></script>
</head>
<body>
<div id="header">
<ul id="nav">
<li> Home </li> <!-- menu-->
<li> Music </li>
<ul class="dropdown">
<li>Albums</li> <!-- drop down list-->
<li>Downloads</li>
<li>Videos </li>
</ul>
<li> Portfolio </li>
<ul class="dropdown">
<li>Photography</li>
<li>Designs</li>
<li>Webpages </li>
</ul>
<li> About </li>
<ul class="dropdown">
<li>Biography</li>
<li>Interests</li>
<li>Goals </li>
</ul>
<li> Contact </li>
</ul>
</div>
<div id="ContentLeft">
</div>
<div id="ContentBottom">
</div>
</body>
</html>
CSS:
body {
color: #666;
text-align: left;
margin: 0px;
font-family: Roboto;
font-weight: lighter;
}
#header {
width:100%;
height:20px;
background:#333;
border-bottom:1px solid #000;
padding: 5px 5px 5px 0px;
}
.dropdown{
display:none;
list-style-type:none;
background:#333;
}
#nav {
list-style-type: none;
margin-top: 0px;
margin-left:-30px;
background:#333;
float:left;
}
#nav li {
padding:0px 10px 0px 10px;
float:left;
}
#nav li a {
color: #666;
text-decoration: none;
}
#nav li a:hover {
color: #CCC;
}
#nav li:hover ul{
display:block;
position: absolute;
margin: 0px 0px 0px -10px;
padding:0;
text-align: left;
}
#nav li:hover li{
float:none;
background:#333;
}
#nav li a:active {
color: #FFF;
}
http://jsfiddle.net/WwuRK/ <--- I want it to work Like this.
You need to wrap <ul> in the <li>. In your current example, you are doing the following:
<body>
<div id="header">
<ul id="nav">
<li> Home </li> <!-- menu-->
<li> Music </li>
^----------- remove
<ul class="dropdown">
<li>Albums</li> <!-- drop down list-->
<li>Downloads</li>
<li>Videos </li>
</ul>
</li> <-------- add removed </li> here
<li> Portfolio </li>
^----------- remove
Remove the tags and add them after the ul.dropdown.
Here is a demo of your current code (DOES NOT WORK):
http://jsfiddle.net/dirtyd77/WwuRK/4/
Here is an updated version of your code:
<div id="header">
<ul id="nav">
<li> Home </li> <!-- menu-->
<li> Music
<ul class="dropdown">
<li>Albums</li> <!-- drop down list-->
<li>Downloads</li>
<li>Videos </li>
</ul>
</li>
<li> Portfolio </li>
<ul class="dropdown">
<li>Photography</li>
<li>Designs</li>
<li>Webpages </li>
</ul>
<li> About
<ul class="dropdown">
<li>Biography</li>
<li>Interests</li>
<li>Goals </li>
</ul>
</li>
<li> Contact </li>
</ul>
</div>
<div id="ContentLeft"></div>
<div id="ContentBottom"></div>
Working demo of the edited code: http://jsfiddle.net/dirtyd77/WwuRK/6/
Hope this helps and let me know if you have any questions.