Connecting Tech Pros Worldwide Forums | Help | Site Map

CSS Menu Issue

Familiar Sight
 
Join Date: Sep 2008
Posts: 255
#1: Oct 9 '09
Below is the code I've created for my menu, it works fine in FF but in IE7 the menu links are moving like in a step formation, I've attached an image of what it looks like in FF and IE7.



Expand|Select|Wrap|Line Numbers
  1. <div id="menu_container">
  2.   <ul class="main_menu">
  3.     <li><a href="index.html">Home</a></li>
  4.     <li><a href="#">News</a></li>
  5.   </ul>
  6. </div>
Expand|Select|Wrap|Line Numbers
  1. /**** Menu ****/
  2. div#menu_container {
  3.     float: left;
  4.     width: 100%;
  5.     height: 25px;
  6.     background-color: #00A7E1;
  7.     margin: 5px 0px 0px 0px;
  8.     clear: left;
  9.     display: inline;
  10. }
  11. ul.main_menu {
  12.     float: left;
  13.     width: 100%;
  14.     margin: 0px;
  15.     padding: 0px;
  16.     list-style: none;
  17.     clear: left;
  18. }
  19. .main_menu li a {
  20.     float: left;
  21.     width: 90px;
  22.     padding: 4px 10px 7px 10px;
  23.     border-right: 1px #CCCCCC solid;
  24.     color: #FFFFFF;
  25.     text-decoration: none;
  26.     text-align: center;
  27.     display: block;
  28. }
  29. .main_menu li a:hover {
  30.     float: left;
  31.     width: 90px;
  32.     height: 14px;
  33.     padding: 4px 10px 7px 10px;
  34.     color: #00A7E1;
  35.     background-color: #FFFFFF;
  36.     display: block;
  37. }

Familiar Sight
 
Join Date: Sep 2008
Posts: 255
#2: Oct 9 '09

re: CSS Menu Issue


Can anyone point me the right direction, I've tried everything and can't figure it out?
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,660
#3: Oct 9 '09

re: CSS Menu Issue


without looking deeper into the code, i’d guess it’s the Microsoft Box Model that’s causing it.
zorgi's Avatar
Member
 
Join Date: Mar 2008
Location: here
Posts: 107
#4: Oct 12 '09

re: CSS Menu Issue


if you remove change this

.main_menu li a {

INTO

.main_menu li {

and than style your <a>
Familiar Sight
 
Join Date: Sep 2008
Posts: 255
#5: Oct 23 '09

re: CSS Menu Issue


Fixed it. After all the investigating and changing code, moving stuff around etc. The below piece of CSS fixed it in IE.
Expand|Select|Wrap|Line Numbers
  1. ul.main_menu li {
  2.     display: inline;
  3. }
Reply