views:

81

answers:

2

Hello All...

I have created a menu and submenu bar for my web app. Now with the css classes that I have applied in is working perfectly in mozilla, chrome,safari. But it's not working fine at all with IE 7 or 8.

The HTML code for the generation of menu is as follows :

<div id="menu">
  <ul class="navigation" id="navigation_menu">
    <li class="navigation_active navigation_first">
      <a href="/Profiler/dashboard/loadDashboard">Dashboard</a>
    </li>
    <li>
      <a href="/Profiler/users/showSearch">Users</a>
    </li>
    ......
  <ul class="subnavigation" id="subnavigation_menu">
    <li class="subnavigation_active subnavigation_first">
      <a href="/Profiler/dashboard/loadDashboard">Master Dashboard</a>
    </li>
    <li>
      <a href="/Profiler/dashboard/loadSecurityDashboard">Security Dashboard</a>
    </li>
    ....
</div>

Now my css classes are as follows :

.navigation {
    list-style-type: none;
    clear: both;
    padding-left: 0px;
border-bottom:1px hidden #d8d8dc; background:#333333 url(../images/menu_main.png) repeat 0px 0px;
margin-top: 0px;
    overflow: hidden; /* Clearing floats */
}

.navigation li {
    float:left; list-style-type: none;
}

.subnavigation {
    list-style-type: none;
    clear: both;
    margin-top: 0px;
    background-color:#ffffff;
    border-bottom:1px solid #000000;
}
.subnavigation li {
    float:left; list-style-type: none; 
}
.subnavigation li a {
    float:left; margin-right:10px; padding:4px 5px; font-size:75%; font-weight:bold; color:#434343
}

Now the menu that is generating in mozilla and other browsers where it's looks pretty is as follows :

alt text

And in IE 7 or 8 it's looks like as follows : alt text I am not getting the exact issue with the IE.. Any help would be highly appreciated...

+1  A: 

It looks like your a tags within .navigation may be behaving as inline, it could be picking up and showing the whitespace. Why not style your .navigation links using the same float technique as those in .subnavigation?

.navigation li a { float: left; padding: 4px 5px; }
babtek
@babtek... No effect on IE of your suggestion :(
Nirmal
+1  A: 

Have you got a CSS reset? Looks like IE might have some default margins or something. Try:

.navigation ul li { margin: 0; }

...before your other margin settings.

Oh and you closed your tags, right? Sorry, just doesn't show up in the code.

As babtek said, .navigation and .subnavigation may be using display:inline. The lack of white background in the subnavigation sounds like and indication of this....not sure though. :) (still pretty noob).

Danae
@Danae.. Thanks for the feedback... tags are closed properly in my code, can u please explain how it is rendering as display:inline in IE ?
Nirmal
I usually implement guess-and-check programming; meaning I don't know exactly how or why something is going wrong, but I'll try a few things to try and fix it. Internet Explorer renders HTML and CSS so randomly, it's best not to look too deeply into it. Even though you are working with IE7 and 8, do a google search for "ultimate IE cheatsheet". It provides some insight into the strange inner workings of IE6. This could help you.
Danae