tags:

views:

45

answers:

2

Having a problem with CSS Menu's in IE. It's my first shot at CSS Menus, so of course there's going to be mishaps. :) It is supposed to display the list items below the list header, but instead it is display it to the right. It shows up perfectly in Firefox, but (of course) not in IE.

What happens (IE): http://vvcap.net/db/7Ti_aj74IaQjwyX7rk43.htp

But it's supposed to display the list items directly below the header of "Marketing."

Code:

ul
{

 background:orange;
 height:25px;
 list-style:none;
 margin:0 auto;
 }
li{

  float:left;
  padding:0px;
  }
li a{

  background: url("images/seperator.gif") bottom left no-repeat;
  color:white;
  display:block;
  font-weight:normal;
  line-height:25px;
  text-align:center;
  text-decoration:none;
  }
li a:hover, ul li:hover a{

   background: #2580a2 url('images/seperator.gif') bottom left no-repeat;
   z-index: 1;
   color:#FFFFFF;
   text-decoration:none;
   }
li ul{

  background:#333333;
  display:none;
  height:auto;
  position:absolute;
  width:156px;
  z-index:500;
  }
li:hover ul{

  display:block;
  z-index:1;
  }
li li {

  background:url('images/sub_sep.gif') bottom left no-repeat;
  display:block;
  width:156px;
  }
li:hover li a{

  background:none;
  }
li ul a{

  display:block;
  height:25px;
  font-size:12px;
  font-style:normal;
  padding:0px 10px 0px 15px;
  text-align:left;
  }
li ul a:hover, li ul li:hover a{

   background:#2580a2 url('images/hover_sub.gif') center left no-repeat;
   color:#ffffff;
   text-decoration:none;
   width:131px;
   }
A: 

In absence of sample html, I knocked up the following, with your css (as posted here) in a style tag in the head.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<title>test</title>
<style type="text/css">
/* Your CSS */
</style>
</head>
<body>

<table class= "table1" cellpadding="0" cellspacing="0" align ="center">
  <tr>
    <td width = "20%">
      <ul>
         <li><a class ="linkDrop" href="Default.aspx">Home</a>  </li>
      </ul>
    </td>
    <td>
      <ul>
        <li>
          <a class ="linkDrop" href="#">Miscellaneous</a>
          <ul>
            <li><a href="#">Subitem 1</a></li>
            <li><a href="#">Subitem 2</a></li>
            <li><a href="#">Subitem 3</a></li>
          </ul>
        </li>
      </ul>
    </td>
    <td>
      <ul>
        <li>
          <a class ="linkDrop" href="#">Miscellaneous</a>
          <ul>
            <li><a href="#">Subitem 1</a></li>
            <li><a href="#">Subitem 2</a></li>
            <li><a href="#">Subitem 3</a></li>
          </ul>
        </li>
      </ul>
    </td>
  </tr>
</table>

</body>
</html>

It worked fine once I added a doctype. Is there any chance that's what you're missing?

--EDIT --

okay, I updated the code above with what I read from your comments and doubled up the last td just to see if it makes a difference for me.

It seems to be fine in standard IE8 and IE8 in IE7 mode. It's failing to do anything in quirks mode or compatability mode though. If it's IE6 you're having the problems with, then the issue is that the :hover psuedo class is only picked up by IE6 when applied to the anchor tags (a), so your li:hover ul will be ignored.

If you want it to work in IE6, you'll need to add in some JavaScript. There's quite a good article over on ALA: http://www.alistapart.com/articles/horizdropdowns/

staticbeast
I copy and pasted your code and it worked... on a test page. However when I put it on my master page (where these dropdowns are located), it broke in Internet Explorer again. Would it have something to do with a master page? Here's my source for wat was broken before:<table class= "table1" cellpadding="0" cellspacing="0" align ="center"> <tr> <td width = "20%"> <ul> <li><a class ="linkDrop" href="Default.aspx">Home</a> </li> </ul> </td> </tr></table></div>
SportsFan33
The TD's repeat all the way across, but I ran out of characters So I have others like this: <td> <ul> <li><a class ="linkDrop" href="#">Miscellaneous</a> <ul> <li><a href="#">Subitem 1</a></li> <li><a href="#">Subitem 2</a></li> <li><a href="#">Subitem 3</a></li> </ul> </li> </ul> </td>
SportsFan33
I've edited my answer with your updated code and another thought on what the problem might be.
staticbeast
A: 

see new boxy menu on tahSin's gaRAge. Thanks.

Tahsin Hasan