How to fix CSS menu bug - html

I have a CSS3 Menu. When a menu items text is too long the design breaks. I want the text to simply move up to fit
the text. For example: At www.casa.gov.au the menu item text REGULATIONS AND POLICY starts higher than the rest
of the items. This prevents the menu width and height changing to fit the larger text.
How would I go about doing this with the menu attached in the JS FIDDLE: http://jsfiddle.net/UU4rm/
The problem is associated with the line height at #css li a { }
CSS CODE
/* MENU */
#cssmenu {
border:none;
border:0px;
margin:0px;
padding:0px;
font-size:12px;
font-weight:bold;
border-bottom: solid 1px rgb(77,77,77);
}
#cssmenu ul {
background:#333333;
height:39px;
list-style:none;
margin:0;
padding:0;
display: table;
width: 100%;
}
#cssmenu li {
padding:0px;
display: table-cell;
width: 115px;
}
#cssmenu li a {
background:#333333 url('../images/seperator.gif') bottom right no-repeat;
color:#FFF;
display:block;
font-weight:normal;
line-height:39px;
margin:0px;
padding:0px 0px;
text-align:center;
text-decoration:none;
width: 115px;
}
#cssmenu li a:hover,
#cssmenu ul li:hover a,
#cssmenu li a:focus,
#cssmenu ul li:focus a{
background: #2580a2;
color:#FFFFFF;
text-decoration:none;
float: none;
}
#cssmenu li ul {
background:#333333;
display:none;
height:auto;
padding:0px;
margin:0px;
border:0px;
position:absolute;
width:230px;
z-index:200;
/*top:1em;
/*left:0;*/
}
#cssmenu li.force-show ul,
#cssmenu li:hover ul,
#cssmenu li a:focus + ul{
display:block;
}
#cssmenu li li {
background:url('../images/sub_sep.gif') bottom left no-repeat;
display:block;
float:none;
margin:0px;
padding:0px;
width:230px;
}
#cssmenu li:hover li a,
#cssmenu li:focus li a {
background:none;
}
#cssmenu li ul a {
display:block;
height:35px;
font-size:11px;
font-style:normal;
margin:0px;
padding:0px 10px 0px 15px;
text-align:left;
width: 205px;
}
#cssmenu li ul a:hover,
#cssmenu li ul li:hover a,
#cssmenu li ul a:focus,
#cssmenu li ul li:focus a{
background:#2580a2 url('../images/hover_sub.gif') center left no-repeat;
border:0px;
color:#ffffff;
text-decoration:none;
width: 205px;
}
#cssmenu p {
clear:left;
}
:focus {
outline:none;
}
::-moz-focus-inner {
border:0;
}
HTML CODE
<div id="cssmenu"> <ul> <li>Home</li>
<li class="has-sub"> Operations <ul>
<li>Individuals
</li>
<li>Aircraft owners
</li>
<li>Aircraft operators
</li>
<li>Flight training
</li>
<li>Aerodromes
</li>
<li>Office of airspace regulation
</li>
<li>Sport aviation
</li>
<li>Class D
</li>
<li>Non-towered aerodromes
</li>
<li>Dangerous goods
</li>
<li>Ground operations
</li>
<li>Non-compliance notice
</li>
<li>Unmanned Aircraft Systems (UAS)
</li>
<li>General Aviation (GA) task force
</li>
<li>Regional Aviation Safety Forum (RASF)
</li>
<li>Drug and Alcohol Management Plans
</li>
</ul></li>
<li class="has-sub"> Airworthiness <ul>
<li>Maintenance regulations
</li>
<li>Personnel
</li>
<li>Certification and design
</li>
<li>Manufacturing
</li>
<li>Continuing airworthiness
</li>
<li>Airworthiness directives
</li>
<li>Maintenance organisations
</li>
<li>Flight test and evaluation
</li>
</ul></li>
<li class="has-sub"> Regulations & Policy <ul>
<li>Current rules
</li>
<li>Changing the rules
</li>
<li>Enforcement action
</li>
<li>Policy notices
</li>
<li>Australia's state safety program
</li>
<li>Performance based navigation (PBN)
</li>
<li>Licensing regulations
</li>
</ul></li>
<li class="has-sub"> Manuals & forms <ul>
<li>Manuals
</li>
<li>Forms
</li>
<li>CASA online store
</li>
<li>Temporary Management Instructions (TMIs)
</li>
</ul></li>
<li class="has-sub"> Education <ul>
<li>AviationWorx
</li>
<li>eLearning catalogue
</li>
<li>Flight Safety Australia
</li>
<li> Pilot guides and information
</li>
<li>OnTrack
</li>
<li>Human factors
</li>
<li>Safety management systems
</li>
<li>Seminars and workshops
</li>
<li>Aviation safety advisers
</li>
<li>Advice for air travellers
</li>
<li>CASA online store
</li>
<li>Out-n-Back
</li>
</ul></li>
<li class="has-sub"> Services <ul>
<li>Licences & registrations
</li>
<li>Self Service Portal
</li>
<li>Service standards & fees
</li>
<li>Permission application centre (PAC)
</li>
<li>Aviation medicals
</li>
<li>Delegates and authorised persons
</li>
</ul></li>
<li class="has-sub"> About CASA <ul>
<li>Contact CASA
</li>
<li>CASA board
</li>
<li>CASA's Director
</li>
<li>Recent media releases
</li>
<li>Corporate publications
</li>
<li>CASA on Twitter
</li>
<li>Corporate policy
</li>
<li>Careers at CASA
</li>
<li>Research and statistics
</li>
</ul></li>
</ul>
</div>

It looks to me (in FF), that it's the bottom border attribute that's causing a goofy black line under your menu.
#cssmenu {
border-bottom: solid 1px rgb(77,77,77);
}
Eliminating that bottom border attribute, and adding addition text to the menu items (causing a wrap/second line) acted as expected.

Related

How to make droppable menu

I have a problem. I can't crate my droppable menu.
https://probapro2.blogspot.com/
I work on Menu 1, but I don't know what to add to make the drop menus to move on right.
<link href='http://fonts.googleapis.com/css?family=Oswald:300,400' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:300' rel='stylesheet' type='text/css' />
<div class="nav">
<ul class="menu" id="menu">
<li> home </li>
<li class=""> <a class="drop-ctg" href="#">category</a>
<ul style="overflow: hidden; display: block; height: 0px; z-index: 1072; opacity: 0;">
<li> Category 1 </li>
<li> Category 2 </li>
<li> Category 3 </li>
<li> Category 4 </li>
</ul>
</li>
<li class="">
Menu 1
<ul style="overflow: hidden; display: block; height: 0px; z-index: 1069; opacity: 0;">
<li class="dir">
Menu 2
<ul style="overflow: hidden; display: block; height: 0px; z-index: 1070; opacity: 0;">
<li style="margin-left:50px;"> Menu 3 </li>
<li> Menu 3 </li>
<li> Menu 3 </li>
</ul>
</li>
<li class=" "> Menu 2 </li>
<li> Menu 2 </li>
<li> Menu 2 </li>
</ul>
</li>
<li> Menu 2 </li>
<li> Menu 3 </li>
<li> Menu 4 </li>
<li> 404 Error Page </li>
</ul>
</div>
Here JS fiddle: https://jsfiddle.net/0ugodkb3/2
I want to make Menu 1 to have a droppable menu with menu 2 and on first menu 2, I want to show menu 3.
You can use for that css rule transform with translate value like this:
*{
margin:0;
padding:0;
outline:0;
}
.nav {
width:950px;
height:auto;
border-bottom:1px solid #eee;
margin:10px auto 5px;
display:inline-block;
}
.menu {
width:auto;
list-style:none;
font:$pagenavifont;
text-align:center;
margin:0 auto;
}
.menu a {
float:left;
color:#999;
text-decoration:none;
text-transform:uppercase;
width:auto;
line-height:36px;
padding:0 20px;
}
.menu a:hover,li.menuhover a{
color:#111;
}
.menu li {
position:relative;
float:left;
width:auto;
}
.menu li:last-child {
background:none;
}
.menu ul{
display:none;
position:absolute;
top:36px;
left:0;
background:#fbfbfb;
display:none;
list-style:none;
}
.menu ul li{
float:none;
border-top:1px solid #e3e3e3;
border-right:1px solid #e3e3e3;
border-left:1px solid #e3e3e3;
width:auto;
background:none;
}
.menu ul li:last-child {
border-bottom:1px solid #e3e3e3
}
.menu ul li a{
float:none;
display:block;
background:none;
line-height:36px;
min-width:137px;
width:auto;
text-align:left;
padding-left:10px;
color:#444;
}
.menu ul li a:hover{
background:#fdfdfd;
color:#777;
}
.menu > li > ul {
display: none;
}
.menu > li > ul > li > ul {
transform: translate(100%,0);
display: none;
margin-top: -37px;
}
.menu > li:hover > ul,
.menu > li > ul > li:hover > ul {
display: block;
}
<div class="nav">
<ul class="menu">
<li>
home
</li>
<li class="">
<a class="drop-ctg" href="#">category</a>
<ul>
<li>
Category 1
</li>
<li>
Category 2
</li>
<li>
Category 3
</li>
<li>
Category 4
</li>
</ul>
</li>
<li>
Menu 1
<ul>
<li class="dir">
Menu 2
<ul>
<li>
Menu 3
</li>
<li>
Menu 3
</li>
<li>
Menu 3
</li>
</ul>
</li>
<li>
Menu 2
</li>
<li>
Menu 2
</li>
<li>
Menu 2
</li>
</ul>
</li>
<li>
Menu 2
</li>
<li>
Menu 3
</li>
<li>
Menu 4
</li>
<li>
404 Error Page
</li>
</ul>
</div>
The main thing is to use > selector when defining the display rule for nested menus. This is all what I've added to your css code:
.menu > li > ul {
display: none;
}
/* Position for the 3rd level menu */
.menu > li > ul > li > ul {
transform: translate(100%,0);
display: none;
margin-top: -37px;
}
.menu > li:hover > ul,
.menu > li > ul > li:hover > ul {
display: block;
}
There are a few things that go into making a dropdown menu. It sounds like you're trying to make a dropdown menu that opens up nested menus.
Each pop-out menu will need to:
1) Know the position of the parent that is opening the menu to know where it should be appended.
2) Calculate where the nav should pop up based on where there user is on the browser/screen
You need to append the nav on the right of the menu header you want to open. I'm not sure what your restrictions are but there are vanilla js options:
https://gomakethings.com/how-to-insert-an-element-after-another-one-in-the-dom-with-vanilla-javascript/
that you can use, and also use a mix of position: relative; and position: fixed; to add your nested menus to the right of it's parent.
I would strongly urge you to consider if creating a custom, nested dropdown menu is the right option for you. There are many options out there that have been battle-tested through time. Normally these will also let you style the menu header, and also it's children.
Let me know if you have any more questions :)

My HTML + CSS drop-down menu does not appear when hovering

/* FONTS */
#font-face {
font-family:'MontserratNormal';
src:url(../fonts/montserrat-regular-webfont.eot);
src:url(../fonts/montserrat-regular-webfont.eot#iefix) format("embedded-opentype"),url(../fonts/montserrat-regular-webfont.woff) format("woff"),url(../fonts/montserrat-regular-webfont.ttf) format("truetype"),url(../fonts/montserrat-regular-webfont.svg#MontserratNormal) format("svg");
font-weight:400;
font-style:normal
}
#font-face {
font-family:'MontserratBlack';
src:url(../fonts/montserrat-black-webfont.eot);
src:url(../fonts/montserrat-black-webfont.eot?#iefix) format("embedded-opentype"),url(../fonts/montserrat-black-webfont.woff) format("woff"),url(../fonts/montserrat-black-webfont.ttf) format("truetype"),url(../fonts/montserrat-black-webfont.svg#MontserratBlack) format("svg");
font-weight:900;
font-style:normal
}
#font-face {
font-family:'MontserratBold';
src:url(../fonts/montserrat-bold-webfont.eot);
src:url(../fonts/montserrat-bold-webfont.eot?#iefix) format("embedded-opentype"),url(../fonts/montserrat-bold-webfont.woff) format("woff"),url(../fonts/montserrat-bold-webfont.ttf) format("truetype"),url(../fonts/montserrat-bold-webfont.svg#MontserratBold) format("svg");
font-weight:700;
font-style:normal
}
#font-face {
font-family:"ParentsSuckRegular";
src:url(../fonts/parentssuck.eot);
src:url(../fonts/parentssuck.eot#iefix) format("embedded-opentype"),url(../fonts/parentssuck.woff) format("woff"),url(../fonts/parentssuck.ttf) format("truetype"),url(../fonts/parentssuck.svg) format("svg");
font-weight:700;
font-style:normal
}
/* HEADER */
#logo {
float:left
}
.mainHeader {
clear:both;
color:#000;
background-color:#fff;
height:30px;
padding-bottom:30px
}
.mainNav {
margin:0
}
.mainNav li {
display:inline;
margin-right:50px;
font-family:MontserratBlack;
text-transform:uppercase;
font-size:35px;
color:#BBB;
position:static;
line-height:1.9em
}
#about,#training,#news,#contact,a {
color:#bcbcbc
}
#about:hover,#training:hover,#news:hover,#contact:hover,nav li .current {
color:#13C63E
}
a {
text-decoration:none
}
/* DROP-DOWN MENUS */
.dropdown {
position:relative
}
.drop-nav {
position:absolute;
display:none
}
.drop-nav li {
border-bottom:1px solid rgba(255,255,255,.2)
}
.dropdown:hover > .drop-nav {
display:block
}
.dropdown1 {
position:relative
}
.drop-nav1 {
position:absolute;
display:none
}
.drop-nav1 li {
border-bottom:1px solid rgba(255,255,255,.2)
}
.dropdown1:hover > .drop-nav1 {
display:block
}
<header class="mainHeader">
<ul class="mainNav">
<li>
<a class="current" href="/" id="logo"><img src="images/logo.png"></a>
</li>
<li class="dropdown">
About
<ul class="drop-nav">
<li>
Testimonials
</li>
</ul>
</li>
<li id="news">Services</li>
<li class="dropdown1">
<ul class="drop-nav1">
<li>
The Meltdown
</li>
<li>
Personal Training
</li>
<li>
PIYO / Burn!
</li>
<li>
Little Black Dress
</li>
</ul>
</li>
<li>
Blog
</li>
<li>
Contact Us
</li>
</ul>
</header>
I'm having a bit of trouble with a drop-down menu in my code. I made one based on this. As you can see, the second drop-down menu does not drop. Sorry if this is a simple issue, I started learning HTML and CSS two days ago.
Thanks!
Got it working for you http://jsfiddle.net/b64n0wdn/
Your html was a little bit out of wack, no big deal it happens to the best of us :)
In the you have the first drop down like:
<li class="dropdown">
About
<ul class="drop-nav">
<li>
Testimonials
</li>
</ul>
</li>
In order to make it work I had to put "services" in an anchor uniformly like that previous dropdown, like so:
<li class="dropdown1">
Services
<ul class="drop-nav1">
<li>
The Meltdown
</li>
<li>
Personal Training
</li>
<li>
PIYO / Burn!
</li>
<li>
Little Black Dress
</li>
</ul>
</li>

Add submenu to existing menu

Hi I have a basic menu for which I would like to add a submenu, that appears only when a certain menu link is hovered. Everything I have tried does not hide the submenu when a link is not hovered. Here is my code:
CSS
.navmenu{
float:right;
font-size: 13px;
font-weight:400;
text-transform: uppercase;
}
.navmenu li{
position: relative;
display: inline-block;
float: left;
}
.navmenu li a{
text-decoration:none;
color:#eee;
padding:15px 37px 19px 37px;
}
.navmenu li a:hover{
background:#36332e;
}
.active a{
background:#36332e;
}
HTML
<ul class="navmenu">
<li class="active">Home</li>
<li>About Us
<ul>
<li>Sub Link 1</li>
<li>SubLink 2</li>
</ul>
</li>
<li>Testimonials</li>
<li>Services</li>
<li>Contact Us</li>
</ul>
You need to initially hide the menu:
.navmenu li ul { display: none; }
and then display it when you hover over the nav item:
.navmenu li:hover ul { display: none; }
You should also be careful about defining styles that target .navmenu li or .navmenu li a because those will also target your submenu. You should instead use child selectors, giving you more control over the non-submenu links, so your selectors will look like:
.navmenu > li
.navmenu > li > a
I've encorperated some of those changes into this JSFiddle to get you started:
http://jsfiddle.net/Wexcode/B5P26/
Edit:
This is actually going to lose it's hover state when you hover over the submenu links:
.navmenu > li > a:hover {
background:#36332e;
}
Instead, you should do this:
.navmenu ul { position: absolute; }
.navmenu > li:hover { background: #e6332e; }
.navmenu > li > a { display: block; }
Since the <ul> is nested inside the <li> element, you won't lose the hover state when you hover over the submenu links. I updated the fiddle to reflect these changes.
<ul class="navmenu">
<li class="active">Home</li>
<li>About Us
<ul>
<li>
Sub Link 1
<ul>
</li> <a href=# >hi hi hi</a>
<ul>
<li>hello hello hello</li>
<li>hello hello hello</li>
<li>hello hello hello</li>
</ul>
</li>
</li><a href=# >hi hi hi</a> </li>
</li> <a href=# >hi hi hi</a> </li>
</ul>
</li>
<li>SubLink 2</li>
</ul>
</li>
<li>Testimonials</li>
<li>Services</li>
<li>Contact Us</li>
</ul>

Unable to navigate unorderlist menu via keyboard tab

I am trying to work out why I can not navigate our menu which uses multiple unordered lists via keyboard.
Does anyone have any tips? I have a feeling its more of a CSS issue than html.
RELATED CSS:
/* MENU */
#cssmenu{
border:none;
border:0px;
margin:0px;
padding:0px;
font: 67.5% 'Lucida Sans Unicode', 'Bitstream Vera Sans', 'Trebuchet Unicode MS', 'Lucida Grande', Verdana, Helvetica, sans-serif;
font-size:11px;
font-weight:bold;
}
#cssmenu ul{
background:#333333;
height:39px;
list-style:none;
margin:0;
padding:0;
display: table;
width: 100%;
}
#cssmenu li{
padding:0px;
display: table-cell;
width: 115px;
}
#cssmenu li a{
background:#333333 url('../images/seperator.gif') bottom right no-repeat;
color:#FFF;
display:block;
font-weight:normal;
line-height:39px;
margin:0px;
padding:0px 0px;
text-align:center;
text-decoration:none;
width: 115px;
}
#cssmenu li a:hover, #cssmenu ul li:hover a{
background: #2580a2;
color:#FFFFFF;
text-decoration:none;
float: none;
}
#cssmenu li ul{
background:#333333;
display:none;
height:auto;
padding:0px;
margin:0px;
border:0px;
position:absolute;
width:230px;
z-index:200;
/*top:1em;
/*left:0;*/
}
#cssmenu li:hover ul{
display:block;
}
#cssmenu li li {
background:url('../images/sub_sep.gif') bottom left no-repeat;
display:block;
float:none;
margin:0px;
padding:0px;
width:230px;
}
#cssmenu li:hover li a{
background:none;
}
#cssmenu li ul a{
display:block;
height:35px;
font-size:10px;
font-style:normal;
margin:0px;
padding:0px 10px 0px 15px;
text-align:left;
width: 205px;
}
#cssmenu li ul a:hover, #cssmenu li ul li:hover a{
background:#2580a2 url('../images/hover_sub.gif') center left no-repeat;
border:0px;
color:#ffffff;
text-decoration:none;
width: 205px;
}
#cssmenu p{
clear:left;
}
:focus {outline:none;}
::-moz-focus-inner {border:0;}
RELATED HTML CODE:
<div id="cssmenu"> <ul> <li>Home</li>
<li class="has-sub"> Operations <ul>
<li>Individuals
</li>
<li>Aircraft owners
</li>
<li>Aircraft operators
</li>
<li>Flight training
</li>
<li>Aerodromes
</li>
<li>Office of airspace regulation
</li>
<li>Sport aviation
</li>
<li>Class D
</li>
<li>Non-towered aerodromes
</li>
<li>Dangerous goods
</li>
<li>Ground operations
</li>
<li> Non-compliance notice
</li>
<li>Unmanned Aircraft Systems (UAS)
</li>
<li>General Aviation (GA) task force
</li>
<li>Regional Aviation Safety Forum (RASF)
</li>
<li>Drug and Alcohol Management Plans
</li>
</ul></li>
<li class="has-sub"> Airworthiness <ul>
<li>Maintenance regulations
</li>
<li>Personnel
</li>
<li>Certification and design
</li>
<li>Manufacturing
</li>
<li>Continuing airworthiness
</li>
<li>Airworthiness directives
</li>
<li>Maintenance organisations
</li>
<li>Flight test and evaluation
</li>
</ul></li>
<li class="has-sub"> Regulations & policy <ul>
<li>Current rules
</li>
<li>Changing the rules
</li>
<li>Enforcement action
</li>
<li>Policy notices
</li>
<li>Australia's state safety program
</li>
<li>Performance based navigation (PBN)
</li>
<li>Licensing regulations
</li>
</ul></li>
<li class="has-sub"> Manuals & forms <ul>
<li>Manuals
</li>
<li>Forms
</li>
<li>CASA online store
</li>
</ul></li>
<li class="has-sub"> Education <ul>
<li>AviationWorx
</li>
<li>eLearning catalogue
</li>
<li>Flight Safety Australia
</li>
<li> Pilot guides and information
</li>
<li>OnTrack
</li>
<li>Human factors
</li>
<li>Safety management systems
</li>
<li>Seminars and workshops
</li>
<li>Aviation safety advisers
</li>
<li>Advice for air travellers
</li>
<li>CASA online store
</li>
<li>Out-n-Back
</li>
</ul></li>
<li class="has-sub"> Services <ul>
<li>Licences and registrations
</li>
<li>Service standards and fees
</li>
<li>Self Service Portal
</li>
<li>Permission application centre (PAC)
</li>
<li>Aviation medicals
</li>
<li>Delegates and authorised persons
</li>
</ul></li>
<li class="has-sub"> About CASA <ul>
<li>Contact CASA
</li>
<li>CASA board
</li>
<li>CASA's Director
</li>
<li>Recent media releases
</li>
<li>Corporate publications
</li>
<li>CASA on Twitter
</li>
<li>Corporate policy
</li>
<li>Careers at CASA
</li>
<li>Research and statistics
</li>
<li>International Engagement
</li>
<li>CASA mailing lists
</li>
</ul></li>
</ul>
</div>
It is not working because you only have :hover rules which the keyboard does not trigger. When an element has tab focus it has the :focus pseudo-class, you will notice when you add this that your menu items light up when focused but still don't open the menu.
jsFiddle: With :focus rules along side :hover rules
This is due to the following rule:
#cssmenu li:hover ul,
#cssmenu li:focus ul{
display:block;
}
The li never actually gets focus because it has no tab index, the a inside of li gets focus. Since li is a parent of ul but a is a sibling of ul we need to use a different rule to get this targeting to work. We can use the next sibling selector + to target the ul based on a:focus. This gets us one step closer.
#cssmenu li:hover ul,
#cssmenu li a:focus + ul{
display:block;
}
jsFiddle with the above applied
Unfortunately this is as far as you can go with CSS (as far as I'm aware). When we try to go to the next a, :focus will be dropped on the top-level a and the menu will hide as the sub-menu will lose display:block;. Since we can't traverse up the tree when applying styles there is no way we can apply display:block to the ancestor ul when we :focus an a further down.
The only way I can see getting around this is to use JavaScript and handle the focus (and maybe blur()) event for the top-level menu items. We must then also handle the click() event to hide the menu when clicking anywhere in the document otherwise it will stay active.
jsFiddle fully working
CSS
#cssmenu li.force-show ul,
#cssmenu li:hover ul,
#cssmenu li a:focus + ul{
display:block;
}
JS
$('#cssmenu > ul > li > a').focus(function () {
$('#cssmenu > ul > li').removeClass('force-show');
$(this).parent().addClass('force-show');
});
// Clear the menu class if clicked anywhere in the document.
$(document).click(function () {
$('#cssmenu > ul > li').removeClass('force-show');
});
The problem is, that focus in CSS does not bubble up. The nearest I come is this:
/* for instance use it that way */
#cssmenu li a:hover,
#cssmenu li a:focus,
#cssmenu ul li:hover a,
#cssmenu ul li:focus a { }
The example works for the first level. But while going to the second, the first loses it's :focus, and so the submenu is hidden again. I think you need to help a bit with JavaScript.

Dropdown showing differently in Firefox than in other browsers

I have a problem with Firefox I have a drop down menu at the top of my website this is the code for the CSS
#zone-bar {
background:#E5E5E5;
min-height:30px;
z-index:10;
padding:5px 10px 0;
}
#zone-bar ul li {
float:left;
height:18px;
margin-right:10px;
position:relative;
z-index:10;
padding:5px 5px 0;
}
#zone-bar ul li:hover {
background:#C0C0C0;
}
#zone-bar ul li a {
color:#383838;
display:block;
float:left;
font-size:1.1em;
font-weight:700;
height:23px;
padding-right:3px;
position:relative;
right:-5px;
text-decoration:none;
top:-5px;
}
#zone-bar ul li a:hover,#zone-bar ul li a.zoneCur {
background:url(images/right-hover.png) center right no-repeat;
z-index:10;
}
#zone-bar ul li a span {
position:relative;
top:6px;
}
#zone-bar ul li ul {
background:#FFF;
border:1px solid #ccc;
display:none;
left:0;
position:absolute;
top:29px;
width:150px;
padding:10px 0 0;
}
#zone-bar ul li ul li {
float:none;
height:100%;
margin:0;
padding:0;
}
#zone-bar ul li ul li:hover {
background:none;
}
#zone-bar ul li ul li a {
display:block;
float:none;
margin-left:-5px;
width:140px;
padding:5px 0 0 10px;
}
#zone-bar ul li ul li a:hover {
background:#C0C0C0;
}
#zone-bar ul {
display:block;
}
This is my HTML code
<div id="zone-bar">
<ul><li>
<span>My Account <em><img src="images/arrow.png" alt="dropdown"></em></span>
<ul>
<li>My Account</li>
<li>My Channel</li>
<li>My Videos</li>
<li>Favorites</li>
<li>Playlists</li>
<li>Friend Requests (1)</li>
<li>Logout</li>
</ul></li>
<li>
<span>Messages <em><img src="images/arrow.png" alt="dropdown"></em></span>
<ul>
<li>Messages (1)</li>
<li>Compose New Message</li>
<li>Notifications (0)</li>
</ul></li>
<li>
<span>Videos <em><img src="images/arrow.png" alt="dropdown"></em></span>
<ul>
<li>Recent</li>
<li>Viewed</li>
<li>Featured</li>
<li>Top Rated</li>
<li>Commented</li>
</ul></li>
<li>
<span>Channels <em><img src="images/arrow.png" alt="dropdown"></em></span>
<ul>
<li>Recent</li>
<li >Viewed</li>
<li >Featured</li>
<li >Top Rated</li>
<li >Commented</li>
</ul></li>
<li>
<span>Groups <em><img src="images/arrow.png" alt="dropdown"></em></span>
<ul>
<li>Create New Group</li>
<li>All Time</li>
<li>Today</li>
<li>Yesterday</li>
<li>This Week</li>
<li>Last Week</li>
<li>This Month</li>
<li>Last Month</li>
<li>This Year</li>
<li>Last Year</li>
</ul></li>
<li>
<span>Upload <em><img src="images/arrow.png" alt="dropdown"></em></span>
<ul>
<li>Upload New Video</li>
<li>My Videos</li>
</ul></ul>
</div>
you can see a live demo at doctorwhohd.com
The problem im facing is this in normal all browsers except Firefox it looks like this when you hover over the items
In Firefox all versions i get this
Any help would be great! as this is a problem which i cannot seem to fix and im sure there is something im missing.
Your markup is really ugly for starters,
why have extra <span> tags in the top level <li> tags, why wrap your <img> tags with <em> and don't use for styling purposes.
Clean that up first.
Second, you have a lot of absolute and relative position styles that don't appear to be necessary. Have you tried styling your nav without the use of relative and absolute positioning.
The only place I see relative positioning being useful here is for the little arrow images.
Try that out.
You can give each #zone-bar ul li an explicit width (since it is the width of the li that is overrunning its content).
You may want to give each li an ID or class so that you can control their widths individually.