473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Horizontal dropdown menu position problem

Hi,

I'm struggling with a cross browser solution to position my menu ul and li elements in the same place inside a div.

I'm sure it's something simple, but any help or advice is still greatly appreciated.

This is the home page - http://amberleyknights.110mb.com/home.html

The dropdown menu on 'information' is simply a div that I have a javascript function to change the visibility from "hidden" to "visible". This part works fine.

When I view this at home on my mac (firefox), it appears in the correct place, but at work on my XP machine (also firefox) then the menu items are all shifted slightly to the left making my dropdown menu appear out of place. I can modify the CSS to fix this on my PC, but then it's wrong on my mac.

My HTML
Expand|Select|Wrap|Line Numbers
  1. <div class="menu">
  2.   <ul id="menu">
  3.     <li onclick="location.href='home.html';">Home</li>
  4.     <li onclick="location.href='about.html';">About Us</li>
  5.     <li id="info" onmouseover="dropmenu()" onmouseout="hidemenu()">Information</li>
  6.     <li onclick="location.href='sponsor.html';">Sponsors</li>
  7.     <li onclick="location.href='support.html';">Support</li>
  8.     <li onclick="location.href='contact.html';">Contact</li>
  9. </ul>
  10.  
  11.       <div id="dropdown" onmouseover="dropmenu()" onmouseout="hidemenu()">
  12.     <ul>
  13.       <li onclick="location.href='tables.html';">League Table</li>
  14.       <li onclick="location.href='results.html';">Results</li>
  15.       <li onclick="location.href='fixtures.html';">Fixtures</li>
  16.       <li onclick="location.href='stats.html';" id="bottom">Player Stats</li>
  17.     </ul>
  18.       </div>
  19. </div>
  20.  
My CSS
Expand|Select|Wrap|Line Numbers
  1. .menu
  2.     {
  3.     background-image:url('images/out.png');
  4.     width:560px;
  5.     height:20px;
  6.     -moz-box-shadow: 0px -3px 12px #ffffff;
  7.     -webkit-box-shadow: 0px -3px 12px #ffffff;
  8.     box-shadow: 0px -3px 12px #ffffff;
  9.     position:relative;
  10.     top:-20px;
  11.     }
  12.  
  13. #menu
  14.     {
  15.     padding:0px 0px 0px 26px;
  16.  
  17.     }
  18. #menu ul
  19.     {
  20.     height:20px;
  21.     }
  22.  
  23. #menu li
  24.     {
  25.     float:left;
  26.     height:20px;
  27.     display:inline;
  28.     padding-left:12px;
  29.     padding-right:12px;
  30.     font-weight:bold;
  31.     }
  32.  
  33. #dropdown
  34.     {
  35.     position:absolute;
  36.     left:179px;
  37.     top:20px;
  38.     visibility:hidden;
  39.     z-index:5;
  40.     border-left:1px solid white;
  41.     border-bottom:1px solid white;
  42.     border-right:1px solid white;
  43.     }
  44.  
  45. #dropdown ul
  46.     {
  47.     width:107px;
  48.     margin:0;
  49.     padding:0;
  50.     }
  51.  
  52. #dropdown li
  53.     {
  54.     display:block;
  55.     background-color:#A0A0A0;
  56.     font-weight:bold;
  57.     border-top:solid grey 1px;
  58.     padding: 2px 0px 2px 0px;
  59.     magin:0;
  60.     opacity: 0.8;
  61.     filter: alpha(opacity=80);
  62.     }    
  63.  
Obviously I'm missing an important statement in the CSS to position it correctly no matter what browser/OS it is viewed in.

Thanks for listening/reading,
Phil
May 26 '11 #1

✓ answered by Phil Gent

Ok, I have solved my problem.
It was an issue with the text length differing causing the <li>s to be longer/shorter so I have given each a set width and now it should work accross the board.
Thanks Dormlich, I have downloaded firebug, looks quite a handy little program.

2 2803
Dormilich
8,658 Expert Mod 8TB
check in firebug, whether both browsers use different default settings for the <div>, <ul> & <li> (HTML tab, calculated style/layout)
May 27 '11 #2
Ok, I have solved my problem.
It was an issue with the text length differing causing the <li>s to be longer/shorter so I have given each a set width and now it should work accross the board.
Thanks Dormlich, I have downloaded firebug, looks quite a handy little program.
May 27 '11 #3

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

Similar topics

9
by: =?Utf-8?B?ZHBvbXQ=?= | last post by:
Hello, I have a problem with the ASP.NET menu when rendered in IE7: If the menu is inside a div with style="position:fixed;top:3em;", all the submenus also have the top:3em. Is this an IE7...
4
torquehero
by: torquehero | last post by:
Hi all :) I have created a horizontal navbar using Xara Menumaker. The Menu items have several dropdown menus. Its a javascript. When the mouse cursor is moved over any menu item, a dropdown...
1
by: camphor | last post by:
hi, I have a single column webpage with a horizontal dropdown menu and am trying to make the nav bar fit across the page, the column is 800px, it looks ok in dreamweaver 8 but when I test it in...
6
by: adz1809 | last post by:
I have created this horizontal dropdown menu in css which is working fine in IE6+ but isn't firefox, and I have no idea why. here is the code: HTML: <body id="our-travels" class="home"> <div...
1
saputello
by: saputello | last post by:
hello! i found an article on making a dropdown menu at this page: http://www.alistapart.com/articles/dropdowns/ i've had no problem making it work in every browser i've tried other than...
19
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the...
2
by: thor008u2 | last post by:
Need answer to this apparent universal IE problem of drop down submenus not displaying over moving graphics. Seems to work with static imagery(?). Menu works with all other browsers on WIN and MAC. ...
2
by: neovantage | last post by:
Hey all, I have integrated UL, Li base dropdown menu but it is bevaing abnormal in IE. Can somebody have a look on my code and help me out to fix the problem. Here is the Link of my website. ...
0
by: Helena Tran | last post by:
I'm doing a dropdown-menu, and combine JS. It's display well in all browser, but it has an error when displaying in IE 7,8 browser: Menu dropdown in normal : ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.