473,808 Members | 2,882 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CSS Menu problem

347 Contributor
I have made a CSS menu and am finding that sometimes the sub menu items go off the screen depending on the resolution. Does anyone know if there is a way to prevent this?

CSS is as follows
Expand|Select|Wrap|Line Numbers
  1. <style type="text/css"> 
  2. body{
  3.     behavior:url(../scripts/cssHoverFix.htc);
  4.     background-color: #000000;
  5. }
  6. #navigation {width:180px; font-size:12px;}
  7.  
  8. /*Main Menu*/
  9. #navigation ul {margin:0px; padding:0px; background-color:#000000;}
  10.  
  11. #navigation ul li {
  12. font-family:"Cooper Black";
  13. text-align:center;
  14. font-size:16px;
  15. height:25px;
  16. line-height:25px; 
  17. list-style:none; 
  18. padding-left:10px;
  19.  
  20. color:#FFFfff; 
  21. border-top:#ef007b solid;  
  22. border-left:#ef007b solid;
  23. border-right:#ef007b solid;
  24. border-width:1px;
  25. cursor:pointer; 
  26. }
  27. #navigation ul li:hover {background-color:#000000; position:relative; font:"Cooper Black"; color:#ef007b}
  28.  
  29. #navigation ul ul li:hover {background-color:#ffffff; position:relative; font:"Cooper Black"; color:#ef007b}
  30.  
  31. /*Sub Menu*/
  32. #navigation ul ul {
  33. display:none;
  34. position:absolute;
  35. left:100px;
  36. top:5px;
  37. border:#ef007b solid;
  38. border-width:1px;
  39. background-color:#ffffff;
  40. }
  41. #navigation ul li:hover ul {display:block;}
  42.  
  43. #navigation ul ul li { width:120px; float:left; display:inline; border:#ef007b solid;
  44. border-width:1px; color:#000000;}
  45.  
  46. </style>
  47.  
And html is as follows
Expand|Select|Wrap|Line Numbers
  1. <div id="navigation">
  2.               <ul>
  3.                 <li><a href="boys.asp?id=Afro - Caribbean" class="mainlink">Afro Caribbean</a></li>
  4.                 <li><a href="boys.asp?id=Comedy" class="mainlink">Comedy</a></li>
  5.                 <li><a href="boys.asp?id=Corporate" class="mainlink">Corporate</a></li>
  6.                 <li><a href="boys.asp?id=DJ Sound" class="mainlink">DJ Sound</a></li>
  7.                 <li><a href="boys.asp?id=Indian" class="mainlink">Indian</a></li>
  8.                 <li><a href="boys.asp?id=Irish" class="mainlink">Irish</a></li>
  9.                 <li><a href="boys.asp?id=Light/Friendly" class="mainlink">Light/Friendly</a></li>
  10.                 <li><a href="boys.asp?id=London" class="mainlink">London</a></li>
  11.                 <li>Northern
  12.                   <ul>
  13.                       <li><a href="boys.asp?id=Northern" class="sublink">All</a></li>
  14.                       <li><a href="boys.asp?id=Brummie" class="sublink">Brummie</a></li>
  15.                       <li><a href="boys.asp?id=Geordie" class="sublink">Geordie</a></li>
  16.                       <li><a href="boys.asp?id=Lancashire" class="sublink">Lancashire</a></li>
  17.                       <li><a href="boys.asp?id=Liverpool" class="sublink">Liverpool</a></li>
  18.                       <li><a href="boys.asp?id=Lancashire" class="sublink">Lancashire</a></li>
  19.                       <li><a href="boys.asp?id=Yorkshire" class="sublink">Yorkshire</a></li>
  20.                     </ul>
  21.                 </li>
  22.                 <li><a href="boys.asp?id=Posh" class="mainlink">Posh</a></li>
  23.                 <li><a href="boys.asp?id=Scottish" class="mainlink">Scottish</a></li>
  24.                 <li><a href="boys.asp?id=Sexy" class="mainlink">Sexy</a></li>
  25.                 <li>Standard UK - 30's +
  26.                   <ul>
  27.                       <li><a href="boys.asp?id=30s/40s" class="sublink">30's/40's</a></li>
  28.                       <li><a href="boys.asp?id=40+" class="sublink">40+</a></li>
  29.                     </ul>
  30.                 </li>
  31.                 <li><a href="boys.asp?id=Teen/20s" class="mainlink">Teen/20's</a></li>
  32.                 <li><a href="boys.asp?id=USA/Mid Atlantic" class="mainlink">USA/Mid Atlantic</a></li>
  33.                 <li>Versatile
  34.                   <ul>
  35.                       <li><a href="boys.asp?id=Versatile" class="sublink">All</a></li>
  36.                       <li><a href="boys.asp?id=Accents" class="sublink">Accents</a></li>
  37.                       <li><a href="boys.asp?id=Anything" class="sublink">Anything</a></li>
  38.                       <li><a href="boys.asp?id=Characters" class="sublink">Characters</a></li>
  39.                       <li><a href="boys.asp?id=Impressions" class="sublink">Impressions</a></li>
  40.                       <li><a href="boys.asp?id=Wacky" class="sublink">Wacky</a></li>
  41.                     </ul>
  42.                 </li>
  43.                 <li><a href="boys.asp?id=Welsh" class="mainlink">Welsh</a></li>
  44.                 <li style="border-bottom:#ef007b solid; border-width:1px"><a href="boys.asp?id=West country" class="mainlink">West Country</a></li>
  45.               </ul>
  46.             </div>
Thanks
Apr 14 '10 #1
7 2558
drhowarddrfine
7,435 Recognized Expert Expert
You are using 'behavior' which is non-standard and only works in IE. Also, you are using asp, which most don't use, so we need to see the generated markup. A link is better.
Apr 14 '10 #2
colinod
347 Contributor
Here is a link to the page

http://www.yaketyyakallmouth.com/pages/boys.asp?id=all

The behavoir is there to correct errors in old version of IE
Apr 14 '10 #3
drhowarddrfine
7,435 Recognized Expert Expert
The ul for those lists is position:absolu te 100px which is causing that.
Apr 14 '10 #4
colinod
347 Contributor
I have tried all the variations of the position element and they dont help, changing the number only moves it, i want it to move automatically if the sub menu goes out of the edge of the window, not sure if this is possible with CSS or needs a script language also
Apr 15 '10 #5
drhowarddrfine
7,435 Recognized Expert Expert
Then you need to use a percentage for that so it moves relative to the width.

Busy next two days for me. Not sure when I can test this.
Apr 15 '10 #6
colinod
347 Contributor
Thanks for that i did not know you could use percentages ill have a play and see what i can do
Apr 15 '10 #7
colinod
347 Contributor
have made thise changes and its better thansk for that, i am now trying to get the sub menu background transparent, i have this done but the first link you rollover goes either transparent or white when you roll out of it, any ideas??
Apr 15 '10 #8

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

Similar topics

4
3850
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following beautiful script "http://javascript.internet.com/navigation/toolbar-menu.html". It works like a charm. I made my webpage in frames, where the nav-frame shows the menubar, so whenever I click a link in the menubar, it opens in the frame below. But...
2
3908
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at http://home.pacific.net.sg/~jacksony ? (the drop down bar could not work at www.apchosting.net but can drop at home.pacific.net.sg. I suspect it is a server problem but was told it is not possible, therefore assuming it is a client script problem? the script works last time...
4
5197
by: Stromboli | last post by:
hi people, My problem is that I need to build a dynamic menu (preferably that works in all the browsers) that appears when I mouseover a certain link. The problem is that I have to declare the menu content in the same part of the page where the menu goes (BODY). The content of the page is generated dynamically so I can't put the menu content it on the headers.
7
2718
by: Chuck Hartman | last post by:
I have a Windows service that requests web pages from a site using an HttpWebRequest object. When I try to request a page from an ASP.NET 2 site, I get a WebException with message "The remote server returned an error: (500) Internal Server Error." I found a post that suggested to catch the WebException to retrieve the actual HttpWebResponse object for more information. The response returned is shown below. At first I thought this was a...
2
3064
by: Gary Wessle | last post by:
Hi I need help organizing this program in the right way. I included the code below which compiles and runs and gives the desired effect to a certain point, but I don't know what the next step is to finish this program. the program presents Main menu to the user and gives a prompt, the user types the number corresponding to an item from the menu, the program then
2
2289
by: Ravi Joshi | last post by:
The menu on my site works fine in IE6 and Firefox. In IE7, there is a problem with the menu: when you mouse over the various main catagories, the sub-catagories all appear to the right as they should; however, as soon as you mouse towards any but the TOP sub-catagory, all those sub-catagories still view there. It will work first time quite fine..but if user clicks outsite anywhere in screen then this problem occur.. i think it's css...
5
1612
by: AG | last post by:
I realize that the obvious suggestion would be malware, but my definitions are up to date and I have already scanned for it. I have also tried disabling all IE add-ons. I just rebuilt and deployed my website (WAP) in ASP.NET 2.0. Everything is working fine except from my development machine with IE6. The master page contains a Menu control bound to a SiteMapDataSource. There is also a row of links (plain links, no menu control) at the...
19
3716
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 code for this from a tutorial but that menu was flush-left justified. Not what I want. Subsequent searches on google on how to center yielded a
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10631
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3859
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.