CSS menu not working in IE6

This is a discussion on "CSS menu not working in IE6" within the Web Page Design section. This forum, and the thread "CSS menu not working in IE6 are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 26th, 2007, 13:10
Junior Member
Join Date: Jan 2006
Location: Spain (Malaga)
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
CSS menu not working in IE6

Hello, I've used a css drop-down menu that should have worked in IE6 (and even IE5.5), but I have IE6 on an older computer, and when checking, I found out that it clearly does not:

screencap_pa_ie6.jpg

It should have looked something like this (screenshot from Opera 9.5 beta):

screencap_pa_opera9.jpg

It works in Firefox 2+, Opera 9+, IE7 and Safari 3, all for Windows, I've checked.

Here's the css:

Code: Select all
/* style the outer div to give it width */
.menu {
    width:769px;
    font-size:11px;
    float: left;
}
/* remove all the bullets, borders and padding from the default list styling */
.menu ul {
padding:0;
margin:0;
list-style-type:none;
}
.menu ul ul {
width:192px; /* changed from 150 px */
}
/* float the list to make it horizontal and a relative positon so that you can control the dropdown menu positon */
.menu li {
float:left;
width:192px;  /* changed from 150 px */
position:relative;
}
/* style the links for the top level */
.menu a, .menu a:visited {
    display:block;
    font-size:11px;
    text-decoration:none;
    color:#fff;
    width:181px;  /* changed from 139px, should be 11 px less than the .menu ul ul and .menu li */
    height:30px;
    border:1px solid #fff;
    border-width:1px 1px 0 0;
    background:#758279;
    padding-left:10px;
    line-height:29px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
}
/* a hack so that IE5.5 faulty box model is corrected */
* html .menu a, * html .menu a:visited {
width:192px; /* changed from 150 px */
w\idth:181px; /* changed from 139px, should be 11 px less than the .menu ul ul and .menu li */
}

/* style the second level background */
.menu ul ul a.drop, .menu ul ul a.drop:visited {
background:#C1BC9E; /* changed from #949e7c */
}
/* style the second level hover */
.menu ul ul a.drop:hover{
background:#c9ba65;
}
.menu ul ul :hover > a.drop {
background:#96886D;
}
/* style the third level background */
.menu ul ul ul a, .menu ul ul ul a:visited {
background:#E2E2CA;
}
/* style the third level hover */
.menu ul ul ul a:hover {
background:#b2ab9b;
}
.menu ul ul ul :hover > a {
background:#b2ab9b;
}

/* hide the sub levels and give them a positon absolute so that they take up no room */
.menu ul ul {
visibility:hidden;
position:absolute;
height:0;
top:31px;
left:0; 
width:192px; /* changed from 150 px to fit with toplevel widht */
}
/* another hack for IE5.5 */
* html .menu ul ul {
top:30px;
t\op:31px;
}

/* position the third level flyout menu */
.menu ul ul ul{
left:192px; /* changed from 150px to fit with the toplevel values */
top:0;
width:192px; /* changed from 150px to fit with the toplevel values */
}
/* position the third level flyout menu for a left flyout */
.menu ul ul ul.left {
left:-192px; /* changed from 150px to fit with the toplevel values */
}

/* style the table so that it takes no part in the layout - required for IE to work */
.menu table {position:absolute; top:0; left:0;}

/* style the second level links */
.menu ul ul a, .menu ul ul a:visited {
    background:#d4d8bd;
    color:#000;
    height:auto;
    line-height:1em;
    padding:5px 10px;
    width:171px; /* changed from 129 px to fit in with toplevel values; should be 21px less that toplevel value */
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 11px;/* yet another hack for IE5.5 */
}
* html .menu ul ul a{
width:192px; /* changed from 150px */
w\idth:171px; /* changed from 129px */
}


/* style the top level hover */
.menu a:hover, .menu ul ul a:hover{
color:#fff; 
background:#949e7c;
}
.menu :hover > a, .menu ul ul :hover > a {
color:#fff;
background:#949e7c;
}

/* make the second level visible when hover on first level list OR link */
.menu ul li:hover ul,
.menu ul a:hover ul{
visibility:visible; 
}
/* keep the third level hidden when you hover on first level list OR link */
.menu ul :hover ul ul{
visibility:hidden;
}
/* keep the fourth level hidden when you hover on second level list OR link */
.menu ul :hover ul :hover ul ul{
visibility:hidden;
}
/* make the third level visible when you hover over second level list OR link */
.menu ul :hover ul :hover ul{ 
visibility:visible;
}
/* make the fourth level visible when you hover over third level list OR link */
.menu ul :hover ul :hover ul :hover ul { 
visibility:visible;
}



/*-------------------------------------
Misc. styling
---------------------------------------*/


#topimage {
    margin-top: 1px;
}

#firstcell a {
        background: #949E7C;
    border-right: 1px solid #fff;
    border-left: 1px solid #fff;
}

#firstcell li {
    border-right: 1px solid #fff;
    z-index: 1;
    overflow: visible;
}
and here's what the html looks like:

HTML: Select all
<div class="menu">
      <ul>
        <!-- dropdown menu: HOME -->
        <li><a href="/">Home
          <!--[if IE 7]><!-->
          </a>
            <!--<![endif]-->
            <!--[if lte IE 6]><table><tr><td><![endif]-->
            <!--[if lte IE 6]></td></tr></table></a><![endif]-->
        </li>
        <!-- end HOME-->
        <li><a href="javascript:void(0)">Media Gallery
          <!--[if IE 7]><!-->
          </a>
            <!--<![endif]-->
            <!--[if lte IE 6]><table><tr><td><![endif]-->
            <ul>
              <li><a href="template.php?page=mphotos">Photos</a></li>
              <li><a href="template.php?page=maudio">Audio &amp; Video Clips</a></li>
            </ul>
          <!--[if lte IE 6]></td></tr></table></a><![endif]-->
        </li>
        <!-- dropdown menu: career -->
        <li><a href="javascript:void(0)">Career
          <!--[if IE 7]><!-->
          </a>
            <!--<![endif]-->
            <!--[if lte IE 6]><table><tr><td><![endif]-->
            <ul>
              <li><a href="template.php?page=biography" title="A short biography">Biography</a></li>
              <li><a href="template.php?page=repertory" title="List of Repertory">Repertoire</a></li>
              <li><a class="drop" href="javascript:void(0)" title="Performance History">Performance Annals
                <!--[if IE 7]><!-->
                </a>
                  <!--<![endif]-->
                  <!--[if lte IE 6]><table><tr><td><![endif]-->
                  <ul class="left">
                    <li><a href="template.php?dir=career&page=debut" title="Paul Asciak Debut, 1946">Debut 1946</a></li>
                    <li><a href="template.php?dir=career&page=aida" title="Aida with the Impresa Cantoni">Aida Cantoni</a></li>
                    <li><a href="template.php?dir=career&page=schipa" title="Under the wings of Schipa & Caniglia">Schipa/Caniglia</a></li>
                    <li><a href="javascript:void(0)" title="The Years in Italy">&laquo; Italy
                      <!--[if IE 7]><!-->
                      </a>
                        <!--<![endif]-->
                        <!--[if lte IE 6]><table><tr><td><![endif]-->
                        <!-- flyout thirdlevel submenu  (Italy) -->
                        <ul class="left">
                          <li><a href="template.php?dir=career&page=verdi" title="The Verdi Celebrations">Verdi Celebrations</a></li>
                          <li><a href="template.php?dir=career&page=spoleto" title="The Spoleto Festival and Competition">Spoleto</a></li>
                          <li><a href="template.php?dir=career&page=preroh" title="The Years prior to Royal Opera House, Covent Garden">Work &amp; Activities </a></li>
                        </ul>
                      <!--[if lte IE 6]></td></tr></table></a><![endif]-->
                    </li>
                    <li>
                      <!-- UK -->
                      <a href="javascript:void(0)" title="Works and Activity in England">&laquo; England
                        <!--[if IE 7]><!-->
                      </a>
                      <!--<![endif]-->
                      <!--[if lte IE 6]><table><tr><td><![endif]-->
                      <!-- flyout thirdlevel submenu (UK) -->
                      <ul class="left">
                        <li><a href="template.php?dir=career&amp;page=rosa" title="The Carl Rosa Company">Carl Rosa</a></li>
                        <li><a href="template.php?dir=career&amp;page=bbc" title="The BBC Engagements">BBC</a></li>
                        <li><a href="template.php?dir=career&amp;page=roh" title="The Years with the Royal Opera House, Covent Garden">Covent Garden</a></li>
                      </ul>
                      <!-- /UK-->
                    </li>
                    <li>
                      <!-- Wales -->
                      <a href="javascript:void(0)" title="Works and Activity in Wales">&laquo; Wales
                        <!--[if IE 7]><!-->
                      </a>
                      <!--<![endif]-->
                      <!--[if lte IE 6]><table><tr><td><![endif]-->
                      <!-- flyout thirdlevel submenu (UK) -->
                      <ul class="left">
                        <li><a href="template.php?dir=career&amp;page=welsh" title="Works and Activity in Wales">Opera in Wales</a></li>
                      </ul>
                      <!-- /Wales-->
                    </li>
                    <li>
                      <!-- Ireland -->
                      <a href="javascript:void(0)" title="Works and Activity in Ireland">&laquo; Ireland
                        <!--[if IE 7]><!-->
                      </a>
                      <!--<![endif]-->
                      <!--[if lte IE 6]><table><tr><td><![endif]-->
                      <!-- flyout thirdlevel submenu (UK) -->
                      <ul class="left">
                        <li><a href="template.php?dir=career&amp;page=ireland" title="Opera in Ireland">Opera in Ireland</a></li>
                        <li><a href="template.php?dir=career&amp;page=variety" title="Variety Shows">Variety shows</a></li>
                      </ul>
                    </li>
                    <li><a href="template.php?dir=career&amp;page=malta">Malta</a></li>
                    <li><a href="template.php?dir=career&amp;page=concerts">Concerts &amp; Miscellanea</a></li>
                  </ul>
              </li>
              <li><a href="template.php?page=discography">Discography</a></li>
            </ul>
        </li>
        <!-- end career -->
        <li><a href="javascript:void(0)">About this site
          <!--[if IE 7]><!-->
          </a>
            <!--<![endif]-->
            <!--[if lte IE 6]><table><tr><td><![endif]-->
            <ul>
              <li><a href="template.php?page=name">The name Asciak</a></li>
              <li><a href="template.php?page=contact" title="Contact Details">Contact details</a></li>
              <li><a href="template.php?page=credits" title="Credits & Acknowledgements">Credits</a></li>
              <li><a href="template.php?page=disclaimer" title="Disclaimer">Disclaimer</a>
                  <!--[if lte IE 6]></td></tr></table></a><![endif]-->
              </li>
            </ul>
        </li>
      </ul>
    </div>
    <!-- end menu -->
It's a bit of a mess, so I'm sure I've messed up something, but I can't see it at the moment. Help and fresh eyes much appreciated.

Thanks!

Last edited by karinne; Nov 26th, 2007 at 13:11. Reason: Please attach BIG images.
Reply With Quote

  #2 (permalink)  
Old Nov 26th, 2007, 13:47
Junior Member
Join Date: Jan 2006
Location: Spain (Malaga)
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS menu not working in IE6

Sorry, I should say that the original css comes from Stu Nicholls, http://www.cssplay.co.uk/, and you can find it here: http://www.cssplay.co.uk/menus/simple_vertical.html

/J
Reply With Quote
  #3 (permalink)  
Old Nov 26th, 2007, 17:51
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS menu not working in IE6

Code: Select all
/* a hack so that IE5.5 faulty box model is corrected */
* html .menu a, * html .menu a:visited {
width:192px; /* changed from 150 px */
w\idth:181px; /* changed from 139px, should be 11 px less than the .menu ul ul and .menu li */
}
I see a typo on the last line. width has a \ in it.

See if that fixes your problem...
Reply With Quote
  #4 (permalink)  
Old Nov 26th, 2007, 18:05
Junior Member
Join Date: Jan 2006
Location: Spain (Malaga)
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS menu not working in IE6

Thanks Lchad, but this is a css hack to fix IE5.5 faulty box model rendering. Whether one should use these hacks or not, is a different question, but it's not a typo and it cannot explain why practically no content is showing in IE6 (I haven't checked the page in IE5.5 yet).
Reply With Quote
  #5 (permalink)  
Old Nov 26th, 2007, 18:24
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS menu not working in IE6

Here is another issue.
Code: Select all
/* another hack for IE5.5 */
* html .menu ul ul {
top:30px;
t\op:31px;
}
delete that second t\op:31px;

Not sure if it has any bearing on your problem but, every little bit helps.

I'd need about 2 hours to go through all that code to see what the problem is. Sorry I don't have time for that at the moment.

I'd go line by line and compare what cssplay has for the ie6 hacks and check yours.

Don't even both with ie5.5 or earlier.
Reply With Quote
  #6 (permalink)  
Old Nov 26th, 2007, 20:17
Junior Member
Join Date: Jan 2006
Location: Spain (Malaga)
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS menu not working in IE6

Uhu, Lchad, don't loose any sleep over it! Seriously. I have to go over it line by line myself. I'm sorry, it was a lot of code.

I agree, I am not going to worry about IE5.5, I was almost thinking "why worry about IE6" as well, but there are still a lot of people on IE6. But for a moment I thougth about getting a browser detection script that wil simply redirect you to another page saying "Your browser cannot render this page. Please update." Or something like that.

Anyway, thanks for offering to go through it all; you are very kind.
Reply With Quote
  #7 (permalink)  
Old Nov 28th, 2007, 00:28
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS menu not working in IE6

You can also use a conditional comment for your <link>ed stylesheet. Like this:
HTML: Select all
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" media="screen" href="ie6.css" />
<![endif]-->
This stylesheet will only be used by IE 6 and below :: lte means - less than or equal to

Hope that helps
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
  #8 (permalink)  
Old Nov 28th, 2007, 01:31
Junior Member
Join Date: Jan 2006
Location: Spain (Malaga)
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS menu not working in IE6

Yes, I guess, but then I would have to create a separate css for IE6 and twek the template design for IE6 as I will not be able to use the drop down flyout menu...
Reply With Quote
  #9 (permalink)  
Old Nov 28th, 2007, 01:42
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS menu not working in IE6

At least it's kinder to your users than telling them "You can't come in here. Get an upgrade!" You will lose viewers that way...
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)
Reply With Quote
  #10 (permalink)  
Old Nov 28th, 2007, 09:40
welshstew's Avatar
Lead Administrator

SuperMember
Join Date: May 2007
Location: inside the outside
Posts: 1,485
Blog Entries: 13
Thanks: 1
Thanked 20 Times in 18 Posts
Re: CSS menu not working in IE6

if you want to quickly and easily compare files then take a look at windiff.

It will highlight the differences for you, so no need to go through line by line by hand.

Stew
__________________
WelshStew
Lead Administrator

tierney rides tboard - uk site | xtreme wales - extreme clothing
If you think I've helped, click the "Thanks"
webforumz - facebook | LinkedIn
Last Blog Entry: Web Standards Curriculum Launched (Jul 8th, 2008)
Reply With Quote
  #11 (permalink)  
Old Nov 29th, 2007, 22:38
Junior Member
Join Date: Jan 2006
Location: Spain (Malaga)
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS menu not working in IE6

I guess it would be better to allow for a separate css file for IE6 rather than turning users away. But damn: I wish they'd upgrade!

I might try out windiff - thanks for the tip!

/J
Reply With Quote
  #12 (permalink)  
Old Dec 6th, 2007, 13:03
Junior Member
Join Date: Jan 2006
Location: Spain (Malaga)
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS menu not working in IE6

Just an update:

I haven't been able to solve this altogether, but at least I've managed to make the page load in IE6 - and I'm now completly forgetting about IE5.5, even though this menu should in principle work for that browser as well. Not all items in the menu are visible yet, but I'm working on it.

The problem seems to have been, partially at least, inconsistent use of conditionals. In order to make the dropdown/flyouts work, the author of the original css code used conditionals for the IE browsers:

HTML: Select all
<li><a href="#"><!--[if IE 7]><!-->LINK</a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
Now, IE7 (and all other more or less standards compliant browsers) should close the <a> tag as expected, but when it comes to IE6 (and supposedly IE5.5) the browser must be fooled into thinking the <a> tag is closed much later, in fact after your entire list:

HTML: Select all
<li><a href="#"><!--[if IE 7]><!-->LINK</a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
  <ul>
     <li><a href="#">sublink 1</a></li>
     <li><a href="#">sublink 2</a></li>
  </ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>
What this should do, is to let IE6 create a table and have the <ul> flow down into it. The reason is that IE5.x and IE6 do not understand li:hover, so the unordered list has to be nested in a table.

This is a bit complicated and I would probably have been much better off with a simpler way of creating these menus, using javascript and dhtml. But, it s a pure css menu and it should validate..
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Working on a drop down menu, but the dropdown section doesn't overlap div below in IE MikeTheVike Web Page Design 1 Mar 25th, 2008 17:32
preloader not working with a sliding menu script nikising Flash & Multimedia Forum 4 Jun 5th, 2007 14:58
I have a normal css menu, but want ot add drop down menu to it multichild Web Page Design 7 Jan 9th, 2007 16:07
Drop Down Menu not Working Since I added Toggle Javascript to Page davva JavaScript Forum 1 May 19th, 2006 15:03
Png not working timmytots Graphics and 3D 11 May 14th, 2006 07:06


All times are GMT. The time now is 20:07.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43