CSS drop down menu showing right in IE but not in Firefox
Posted: 23 February 2009 06:58 AM   [ Ignore ]
Newbie
Rank
Total Posts:  2
Joined  2009-02-23

I have programmed a drop down menu in css and it works fine in Internet Explorer but when I check it with firefox it is a mess. I have tried everything to get it right and it doesnt work out. The site is http://www.dmxledlights.com/ and the css is the following:

#mainNav {
    
positionrelative;
    
margin-top20px;
    
margin-bottom20px;
    
width711px;
    
floatright;
    
height31px;
}
/* NAV MENU STYLES */
ul#nav1 {
    
margin0;
    list-
stylenone;
    
height31px;
    
padding-top1px;
    
padding-right0;
    
padding-bottom1px;
    
padding-left0;
    
floatleft;
}
ul
#nav1 li {
    
margin0;
    
padding0;
    
displayblock;
    
positionrelative;
    
floatleft;
}
ul
#nav1 li a:link, ul#nav1 li a:visited {
    
displayblock;
    
line-height31px;
    
text-decorationnone;
    
font-familyArial;
    
font-size12px;
    
background-imageurl(../images/boton_negro.jpg);
    
height31px;
    
width129px;
    
text-aligncenter;
    
color#fff;
}
ul
#nav1 li.first a:link, ul#nav1 li.first a:visited {
    
background-imageurl(../images/boton_negro_i.jpg);
    
background-repeatno-repeat;
    
height31px;
    
width80px;
}
ul
#nav1 li.activeFirst a:link, ul#nav1 li.activeFirst a:visited {
    
background-imageurl(../images/boton_azul_i.jpg);
    
background-repeatno-repeat;
    
height31px;
    
width80px;
}
ul
#nav1 li.active a:link, ul#nav1 li.active a:visited {
    
background-imageurl(../images/boton_azul.jpg);
    
background-repeatno-repeat;
    
height31px;
    
width129px;
}
ul
#nav1 li.last a:link, ul#nav1 li.last a:visited {
    
background-imageurl(../images/boton_negro_f.jpg);
    
background-repeatno-repeat;
    
height31px;
    
width115px;
}
ul
#nav1 li:hover a, ul#nav1 li a:hover, ul#nav1 li a:active {
    
backgroundurl(../images/boton_azul.jpgno-repeat top right;
    
padding0;
    
displayblock;
    
text-aligncenter;
    
text-decorationnone;
    
color#fff;
    
height31px;
    
width129px;
}
ul
#nav1 li.activeFirst:hover a, ul#nav1 li.activeFirst a:hover, ul#nav1 li.activeFirst a:active {
    
backgroundurl(../images/boton_azul_i.jpgno-repeat top right;
    
padding0;
    
displayblock;
    
text-aligncenter;
    
text-decorationnone;
    
color#fff;
    
height31px;
    
width80px;
}
ul
#nav1 li.active:hover a, ul#nav1 li.active a:hover, ul#nav1 li.active a:active {
    
backgroundurl(../images/boton_azul.jpgno-repeat top right;
    
padding0;
    
displayblock;
    
text-aligncenter;
    
text-decorationnone;
    
color#fff;
    
height31px;
    
width129px;
}
ul
#nav1 li.last:hover a, ul#nav1 li.last a:hover, ul#nav1 li.last a:active {
    
backgroundurl(../images/boton_azul_f.jpgno-repeat top right;
    
padding0;
    
displayblock;
    
text-aligncenter;
    
text-decorationnone;
    
color#fff;
    
height31px;
    
width115px;
}
/* NAV SUBMENU STYLES */
ul#nav1 li ul.nav2 {
    
margin0;
    list-
stylenone;
    
displaynone;
    
width200px;
    
positionabsolute;
    
top31px;
    
left1px;
    
padding-top1px;
    
padding-right1px;
    
padding-bottom0;
    
padding-left1px;
}
ul
#nav1 li:hover ul.nav2 {
    
displayblock;
}
ul
#nav1 li ul.nav2 li {
    
width200px;
    
clearleft;
    
width200px;
}
ul
#nav1 li ul.nav2 li a:link, ul#nav1 li ul.nav2 li a:visited {
    
clearleft;
    
width200px;
    
positionrelative;
    
z-index1000;
    
background-imageurl(../images/rolover_back.png);
    
font-familyArial;
    
font-size12px;
    
color#000;
    
height29px;
    
text-alignleft;
    
padding0;
    
text-indent10px;
    
background-repeatrepeat-x;
}
ul
#nav1 li ul.nav2 li:hover a, ul#nav1 li ul.nav2 li a:active, ul#nav1 li ul.nav2 li a:hover {
    
clearleft;
    
padding0;
    
width200px;
    
positionrelative;
    
z-index1000;
    
color#fff;

The HTML is the following:

<div id="mainNav">
      <
ul id="nav1">
        <
li class="activeFirst"><a href="#" title="Home"><strong>Home</strong></a></li>
        <
li><a href="" title="About Us"><strong>About Us</strong></a></li>
        <
li><a href="#" title="Outdoor LED Lighting"><strong>Outdoor LED Lighting</strong></a></li>
        <
ul class="nav2">
          <
li><a href="#">SP90 LED Street Lights</a></li>
          <
li><a href="#">LU1 LED Street Lights</a></li>
          <
li><a href="#">LU2 LED Street Lights</a></li>
          <
li><a href="#">LU4 LED Street Lights</a></li>
          <
li><a href="#">LU6 LED Street Lights</a></li>
          <
li><a href="#">LU8 LED Street Lights</a></li>
          <
li><a href="#">SD2 LED Tunnel Lights</a></li>
          <
li><a href="#">Solar LED Street Lights</a></li>
          <
li><a href="#">LED Traffic Lights</a></li>
          <
li><a href="#">LED Wall Washers</a></li>
        </
ul>
        <
li><a href="#" title="Indoor LED Lighting"><strong>Indoor LED Lighting</strong></a></li>
        <
ul class="nav2">
          <
li><a href="#">MR16 LED Light Bulbs</a></li>
          <
li><a href="#">SP50 LED Light Bulbs</a></li>
          <
li><a href="#">SP70 LED Light Bulbs</a></li>
          <
li><a href="#">SP80 LED Light Bulbs</a></li>
          <
li><a href="#">SP80B LED Light Bulbs</a></li>
          <
li><a href="#">T5 Retrofit LED Light Tubes</a></li>
          <
li><a href="#">T8 Retrofit LED Light Tubes</a></li>
        </
ul>
        <
li><a href="#" title="Fluorescent Lighting"><strong>Fluorescent Lighting</strong></a></li>
        <
ul class="nav2">
          <
li><a href="#">Fluorescent Light Bulbs</a></li>
          <
li><a href="#">Compact Fluorescent Light Bulbs</a></li>
        </
ul>
        <
li class="last"><a href="#" title="Contact Us"><strong>Contact Us</strong></a></li>
      </
ul>
    </
div

Can someone help me out with finding the mistake?? I am getting nuts of not getting it right…

Thank youv ery much in advance…

greetings,


Richard

Profile
 
 
Posted: 23 February 2009 11:28 PM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  2
Joined  2009-02-23

I just found out what is the mistake for not showing right in firefox. When you start a second level in the menu you should not close the <li> yet to which you are going to attach the drop down. this means that the html has to be like this:

<div id="mainNav">
  <
ul id="nav1">
    <
li class="activeFirst"><a href="#" title="Home"><strong>Home</strong></a></li>
    <
li><a href="" title="About Us"><strong>About Us</strong></a></li>
    <
li><a href="#" title="Outdoor LED Lighting"><strong>Outdoor LED Lighting</strong></a/** Here you dont close the </li> yet **/
      
<ul class="nav2">
        <
li><a href="#">SP90 LED Street Lights</a></li>
        <
li><a href="#">LU1 LED Street Lights</a></li>
        <
li><a href="#">LU2 LED Street Lights</a></li>
        <
li><a href="#">LU4 LED Street Lights</a></li>
        <
li><a href="#">LU6 LED Street Lights</a></li>
        <
li><a href="#">LU8 LED Street Lights</a></li>
        <
li><a href="#">SD2 LED Tunnel Lights</a></li>
        <
li><a href="#">Solar LED Street Lights</a></li>
        <
li><a href="#">LED Traffic Lights</a></li>
        <
li><a href="#">LED Wall Washers</a></li>
      </
ul>
    </
li/** but here you do have to close it **/
    
<li><a href="#" title="Indoor LED Lighting"><strong>Indoor LED Lighting</strong></a/** Here you dont close the </li> yet **/
      
<ul class="nav2">
        <
li><a href="#">MR16 LED Light Bulbs</a></li>
        <
li><a href="#">SP50 LED Light Bulbs</a></li>
        <
li><a href="#">SP70 LED Light Bulbs</a></li>
        <
li><a href="#">SP80 LED Light Bulbs</a></li>
        <
li><a href="#">SP80B LED Light Bulbs</a></li>
        <
li><a href="#">T5 Retrofit LED Light Tubes</a></li>
        <
li><a href="#">T8 Retrofit LED Light Tubes</a></li>
      </
ul>
    </
li/** but here you do have to close it **/
    
<li><a href="#" title="Fluorescent Lighting"><strong>Fluorescent Lighting</strong></a>  /** Here you dont close the </li> yet **/
      
<ul class="nav2">
        <
li><a href="#">Fluorescent Light Bulbs</a></li>
        <
li><a href="#">Compact Fluorescent Light Bulbs</a></li>
      </
ul>
    </
li/** but here you do have to close it **/
    
<li class="last"><a href="#" title="Contact Us"><strong>Contact Us</strong></a></li>
  </
ul>
</
div

So it was actually kind of easy…

Greetings,


Richard

Profile
 
 
Posted: 03 August 2010 09:28 AM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  3
Joined  2010-08-03

1. First make sure that the “Element” value is selected at the AllWebMenus property before the menu compilation (fail to do so will make your menu appear at the “Window-related” offsets for some milliseconds and then jump to the element position).


clip0144

2. Edit your HTML page

3. Choose the element where you want your menu to appear

4. Add the following parameter on the element’s tag:

id=“awmAnchor-menu”

where menu should be the actual name of your compiled menu (without the .js extension). If your compiled menu is called “mymenu.js” the following code should be used instead:

id=“awmAnchor-mymenu”

This is all you have do. When a user browses your page, the AllWebMenus script detects the element with the id parameter and shows the menu at the element’s location. If the script does not detect the id, the menu will not appear.

Examples:

A menu (compiled as “menu.js”) is attached to a table using the following code:

<table id=“awmAnchor-menu” width=“150” height=“150” border=“1”>

    clip0149

The same technique applies if the chosen element is different, such as:

TD:

  <td id=“awmAnchor-menu”> </td>

Link:

Menu attached to this link.

Image:

products1.gif

DIV:

<div id=“awmAnchor-menu”>   </div>

SPAN (the most generic element):

<span id=‘awmAnchor-menu’>   </span>

Note that prior to AllWebMenus v4.1 the following code was used for positioning:

<style type=“text/css”>.awmAnchor {position:relative;z-index:0;left:Xpx;top:Ypx}</style>

<span id=‘awmAnchor-menu’ class=‘awmAnchor’> </span>

It is ok to continue using the above code on your pages as it already contains the required id parameter for positioning.

In case you were using OFFSETS on version 4.0, please bear in mind that these OFFSETS are now passed into the menu.js file instead of the above positioning code. Therefore, in order for your OFFSETS not to be *double-counted*, please make sure that you remove the following code from your html pages:

<style type=“text/css”>.awmAnchor {position:relative;z-index:0; left:Xpx; top:Ypx }</style>

clip0148
 

We strongly recommend that you view the related “Live Example” of this property, as it shows most possible combinations on actual HTML pages.

Note: Main Menu is floating - reserve space on your layout:

Remember that a DHTML menu is always floating. It appears over the page contents, not inside them. It does not push other elements away; it just covers them. Therefore, for the Main Menu not to cover other page elements you should arrange for sufficient room on your layout so that the Main Menu appears there. For example, for an horizontal menu of about 440 pixels wide and 44 pixels tall, you could use the following HTML code:

<table> <tr>

<td id=“awmAnchor-menu” width=“440” height=“44”>

 

</td>

</tr> </table>

full version

Profile
 
 
Posted: 27 November 2010 04:13 PM   [ Ignore ]   [ # 3 ]
Newbie
Rank
Total Posts:  3
Joined  2010-11-27
POSERA - 23 February 2009 11:28 PM

I just found out what is the mistake for not showing right in firefox. When you start a second level in the menu you should not close the <li> yet to which you are going to attach the drop down. this means that the html has to be like this:

<div id="mainNav">
  <
ul id="nav1">
    <
li class="activeFirst"><a href="#" title="Home"><strong>Home</strong></a></li>
    <
li><a href="" title="About Us"><strong>About Us</strong></a></li>
    <
li><a href="#" title="Outdoor LED Lighting"><strong>Outdoor LED Lighting</strong></a/** Here you dont close the </li> yet **/
      
<ul class="nav2">
        <
li><a href="#">SP90 LED Street Lights</a></li>
        <
li><a href="#">LU1 LED Street Lights</a></li>
        <
li><a href="#">LU2 LED Street Lights</a></li>
        <
li><a href="#">LU4 LED Street Lights</a></li>
        <
li><a href="#">LU6 LED Street Lights</a></li>
        <
li><a href="#">LU8 LED Street Lights</a></li>
        <
li><a href="#">SD2 LED Tunnel Lights</a></li>
        <
li><a href="#">Solar LED Street Lights</a></li>
        <
li><a href="#">LED Traffic Lights</a></li>
        <
li><a href="#">LED Wall Washers</a></li>
      </
ul>
    </
li/** but here you do have to close it **/
    
<li><a href="#" title="Indoor LED Lighting"><strong>Indoor LED Lighting</strong></a/** Here you dont close the </li> yet **/
      
<ul class="nav2">
        <
li><a href="#">MR16 LED Light Bulbs</a></li>
        <
li><a href="#">SP50 LED Light Bulbs</a></li>
        <
li><a href="#">SP70 LED Light Bulbs</a></li>
        <
li><a href="#">SP80 LED Light Bulbs</a></li>
        <
li><a href="#">SP80B LED Light Bulbs</a></li>
        <
li><a href="#">T5 Retrofit LED Light Tubes</a></li>
        <
li><a href="#">T8 Retrofit LED Light Tubes</a></li>
      </
ul>
    </
li/** but here you do have to close it **/
    
<li><a href="#" title="Fluorescent Lighting"><strong>Fluorescent Lighting</strong></a>  /** Here you dont close the </li> yet **/
      
<ul class="nav2">
        <
li><a href="#">Fluorescent Light Bulbs</a></li>
        <
li><a href="#">Compact Fluorescent Light Bulbs</a></li>
      </
ul>
    </
li/** but here you do have to close it **/
    
<li class="last"><a href="#" title="Contact Us"><strong>Contact Us</strong></a></li>
  </
ul>
</
div

So it was actually kind of easy…

Greetings,


Richard

thank you. Work well now.

diet

Profile
 
 
Posted: 21 December 2010 05:05 PM   [ Ignore ]   [ # 4 ]
Jr. Member
RankRank
Total Posts:  42
Joined  2010-12-14

<div id=“awmAnchor-menu”>  </div>

SPAN (the most generic element):

<span id=’awmAnchor-menu’>  </span>

Note that prior to AllWebMenus v4.1 the following code was used for positioning:

<style type=“text/css”>.awmAnchor {position:relative;z-index:0;left:Xpx;top:Ypx}</style>

<span id=’awmAnchor-menu’ class=’awmAnchor’> </span>


Just tweak this for your site.

Profile
 
 
Posted: 29 December 2010 04:07 PM   [ Ignore ]   [ # 5 ]
Newbie
Rank
Total Posts:  2
Joined  2010-12-29

this was very useful solution:) i have similar problem that my css differs in IE and FF and now I mage to make it works properly under FF :)


___________________________
egipt wakacje

Profile
 
 
Posted: 20 February 2011 10:12 PM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  23
Joined  2011-01-06

As you’ve probably seen by now, building a Web page that displays well on all browsers isn’t easy.

Profile
 
 
Posted: 24 February 2011 10:57 PM   [ Ignore ]   [ # 7 ]
Newbie
Avatar
Rank
Total Posts:  3
Joined  2011-02-24

IE is infamous - another technique is for browser compatibility problems is conditional css [If IE] or [If IE5] for example. The code only renders on the conditional statement. Hopefully IE9 will be standards compliant but there are still so many with older browser versions that refuse to change.

Profile
 
 
Posted: 22 April 2011 12:16 PM   [ Ignore ]   [ # 8 ]
Newbie
Rank
Total Posts:  4
Joined  2010-07-31

Hi Richard,
Thanks a lot for sharing this valuable and excellent article with us. it really works great in Internet Explorer and Firefox. I am appreciating your attempt to create it! Looking forward to another great article.
Good luck.
————————————————————————————————————————————————-
Nootropics | Where to buy Nootropics in Australia

Profile
 
 
Posted: 22 April 2011 12:21 PM   [ Ignore ]   [ # 9 ]
Newbie
Rank
Total Posts:  4
Joined  2010-07-31

Hi Richard,
Thanks a lot for sharing this valuable and excellent article with us. it really works great in Internet Explorer and Firefox. I am appreciating your attempt to create it! Looking forward to another great article.
Good luck.

Language Exchange My Language Exchange

Profile
 
 
Posted: 25 April 2011 07:06 PM   [ Ignore ]   [ # 10 ]
Newbie
Rank
Total Posts:  25
Joined  2010-09-15
blackballonline - 24 February 2011 10:57 PM

IE is infamous - another technique is for browser compatibility problems is conditional css [If IE] or [If IE5] for example. The code only renders on the conditional statement. Hopefully IE9 will be standards compliant but there are still so many with older browser versions that refuse to change.

It’s surprising how many people are still using IE when other browsers are so much better. I’m personally loving Firefox 4.0!

.
________________
modern furniture

Profile
 
 
Posted: 06 June 2011 07:54 PM   [ Ignore ]   [ # 11 ]
Sr. Member
RankRankRankRank
Total Posts:  139
Joined  2010-04-23

Yeah, Firefox is better but IE is the default browser on Windows.
_____________________________
Running - Running Log
5k - 10k - Half Marathon - Marathon

Profile