By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,146 Members | 1,813 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,146 IT Pros & Developers. It's quick & easy.

Horizontal Menu Lining Up Vertically

P: 22
It is late so this is probably something really obvious but I am not seeing it. Can someone please help?

Here is the page in question:
html -
css -

As you can see from the file the menu is showing up vertically not horizontally. I copied the code directly from another site I have done and changed the bullets (I didn't want any) and the colors but I must have jacked the css up somehow.

Here is the other site that I have done this style of menu on before.

html -
css -

I have tried adding css tags like
Expand|Select|Wrap|Line Numbers
  1. #menu ul li {display: inline; } 
but that hasn't worked...I'm really just out of options because I can't see what the issue is, I'm too close to it I guess.

Thank you in advance for any help.
May 14 '09 #1
Share this Question
Share on Google+
7 Replies

Expert 5K+
P: 7,435
I can't find it yet but you have display:block scattered throughout the li and a of #menu which is probably causing the problem.
May 14 '09 #2

P: 22
If I change the display: blocks to something else then the sub menus don't display as a block of items...I will look into the other thing you wrote about when I get back to the office
May 14 '09 #3

P: 22
drhowarddrfine - thanks for the info, I have tried removing all of the display:block commands to no avail as well as removing the problematic #menu command.

The part that is frustrating is that I know this set of css commands works because I have it working on another site so I just have a typo or miscopy somewhere. Thank you for your help, please send any more suggestions that you have.

EDIT: after more investigation, the code that was copied in is intact, it is something on one of the parent objects that it is inheriting that is causing the problem. (I copied the code directly from the other site without modifications and it did the same thing).
May 14 '09 #4

Expert 5K+
P: 7,435
Sorry for not replying. I'm out of town till Monday.
May 15 '09 #5

P: 162
ok.. here you go

add this css menu part in your css page

Add this part on your css page..

Expand|Select|Wrap|Line Numbers
  3. /* this css for new menu*/
  5. /*
  6. menubar is the root UL and menubar ul applies to all the sub-menu ULs.
  7. We set padding and margin to zero to eliminate all indentation, turn bullets off,
  8. and set a font-family different from the global font-family declared for the
  9. body element above. This sets font for just the menu. Do not add a font-size here.
  10. */
  11. #menubar, #menubar ul {
  12.     padding: 0;
  13.     margin: 0;
  14.     list-style: none;
  15.     font-family:  Tahoma, Arial;
  16.     font-weight: bold;
  17. }
  18. /*
  19. Root-Level Links.  Do not change the first two properties.
  20. Adjust padding values to make the root links taller and to offset them
  21. from the left and right edges of the link box. The border right creates a
  22. separator between links. Font-size is set here and will apply to all menu levels.
  23. Font color is set to light gray.
  24. */
  25. #menubar a {
  26.     display: block;
  27.     text-decoration: none;
  28.     padding: 5px 10px 5px 10px;
  29.     border-right: 1px solid #333;
  30.     font-size: .85em;
  31.     color: white;
  33. }
  34. /*
  35. Class assigned to those Root-Level links that have associated Sub-Menus.
  36. The top and bottom padding assigned this element must be the same as
  37. that assigned to the menubar a element. The right padding is increased
  38. to accomodate the display of background image depicting a downward
  39. pointing arrow.
  40. */
  41. #menubar a.trigger {
  42.     padding: 5px 16px 5px 10px;
  43.     background-repeat: no-repeat;
  44.     background-position: right center;
  47. }
  48. /*
  49. The Root-Level list items. Floating left allows
  50. them to appear horizontally. Width is for IE5 Mac. The last rule in
  51. this style sheet will set the width for this element to auto for all
  52. other browsers - hiding it from IE5 Mac. The width is proportional.
  53. As you add and edit root menu items, you will need to test this width
  54. to ensure it is wide enough to accomodate all text.
  55. */
  56. #menubar li {
  57.     float: left;
  58.     width: 9em;
  60. }
  61. /*
  62. Sets width for Sub-Menu box and the List Items inside - in proportional em units. 
  63. This allows the sub-menu width to expand if users resize the text in their browsers.
  64. */
  65. #menubar li ul, #menubar ul li  {
  66.     width: 10em;
  67. }
  68. /*
  69. The sub-menu links. We set color and turn off the right border, which
  70. would otherwise be inherited from the root link rule. We set top and 
  71. bottom padding less than the root items and increas the left padding
  72. to indent the sub-menu links a small amount in from the root links.
  73. */
  74. #menubar ul li a  {
  75.     color: #565656;
  76.     border-right: 0;
  77.     padding: 3px 12px 3px 16px;
  78.     background-color: #FFFFFF;
  79. }
  80. /*
  81. Sub-Menu Unordered Lists describes each dropdown sub-menu grouping. 
  82. Positioned Absolutely to allow them to appear below their root trigger.
  83. Set to display none to hide them until trigger is moused over.
  84. Background Color must be set or problems will be encountered in MSIE.
  85. Right and bottom borders are set to simulate a raised look.
  86. A gradient background image is assigned.
  87. */
  88. #menubar li ul {
  89.     position: absolute;
  90.     display: none;
  91.     background-color: #FFFFFF;
  92.     border-right: 1px solid #333333;
  93.     border-bottom: 1px solid #333333;
  94.     background-repeat: repeat-x;
  96. }
  97. /*
  98. Changes the Text color and background color when the Root-Level
  99. menu items are moused over. The second selector sets color and background
  100. when Root-Level items are accessed with the keyboard tab key. The third
  101. selector sets an active state to support keyboard access in MSIE. The fourth 
  102. selector is assigned to IE5 and IE6 Windows via the script.
  103. Note that IE7 supports hover on elements other than links and so behaves
  104. like Firefox, Opera, and Safari - making the menu operable even if JavaScript
  105. is not enabled.
  106. */
  107. #menubar li:hover a, #menubar a:focus,
  108. #menubar a:active, #menubar li.p7hvr a {
  109.     color: #000000;
  110.     background-color: #cfbe8a;
  111. }
  112. /*
  113. Set the Sub-Menu UL to be visible when its associated
  114. Root-Level link is moused over. The second selector is 
  115. assigned to IE5 and IE6 via the script.
  116. */
  117. #menubar li:hover ul, #menubar li.p7hvr ul {
  118.     display: block;
  119.     background-color: #cfbe8a;
  121. }
  122. /*
  123. Sets the Text color of the Sub-Level links when the Root-Level
  124. menu items are moused over. The second selector is 
  125. assigned to IE5 and IE6 via the script.
  126. The color set should march the normal Sub-Level link color
  127. in the rule: #menubar ul li a. The background color must be
  128. transparent to allow the underlying gradient background on the UL
  129. to show through.
  130. */
  131. #menubar li:hover ul a, #menubar li.p7hvr ul a {
  132.     color: #000000;
  133.     background-color: transparent;
  135. }
  136. /*
  137. The normal hover class for Sub-Level links. The Important directive
  138. is required for older browsers. We set a background color, which shows
  139. over the gradient background. We set text color to white.
  140. */
  141. #menubar ul a:hover {
  142.     background-color: #606060!important;
  143.     color: #FFFFFF!important;
  144. }
  145. /* The single backslash \ character inside this comment
  146. causes IE5 Mac to ignore the following rule, which allows other
  147. browsers to render top-level menu items to their natural width.
  148. Do not edit this rule in any way. */
  149. #menubar li {width: auto;}

i have added the menu on this page just copy and add on this on your menu and replace with old code

Expand|Select|Wrap|Line Numbers
  2. <div id="menutop" > <!-- this is your div already decleared -->
  3.             <div id="menuwrapper">
  5.                 <ul id="menubar">
  6.                     <li>
  7.               <a href="index2.php" class="transparent">Home</a>
  8.             </li>
  9.                 <li><a href="">About T.Hi.N.</a>
  10.           <ul>
  11.             <li><a href="">Tracie Hittman</a></li>
  12.                             <li><a href="">Press</a></li>
  13.                             <li><a href="">My Philosophy</a></li>
  14.                             <li><a href="">Events</a></li>
  15.                             <li><a href="">Testimonials</a></li>
  16.           </ul>
  17.       </li>
  18.       <li><a href="">The 180 Diet</a>
  19.           <ul>
  20.             <li><a href="">The Principles</a></li>
  21.                         <li><a href="">Get Balanced</a></li>
  22.           </ul>
  23.       </li>
  24.       <li><a href="" class="transparent">Services</a>
  25.       </li>
  26.       <li><a href="" class="transparent">Contact Us</a>
  27.       </li>
  28.     </ul>
  29.    </ul>
  30.  </div>
  31.  </div>
i have tested on your page should wrk alright
May 17 '09 #6

P: 22
prabirchoudhury - Thank you so much, I will be trying this out either later today or tomorrow. You rock!!!
May 17 '09 #7

P: 22
prabirchoudhury - this worked like a charm, thanks a lot.
May 18 '09 #8

Post your reply

Sign in to post your reply or Sign up for a free account.