473,657 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I expand the selectable area of a drop down menu within css?

103 New Member
HEllo,
I am working on a project for a friend and have created a horizontal navigation menu. It works well, but when the lists drop down I want to make the entire view selectable and not just over the displayed text. I attached a png photo that highlights what happens when the mouse hovers over the dropdown. I want the entire dropdown area to highlight as to be able to be selected. Can you help dear reader?
Here is also my navigation code:
Expand|Select|Wrap|Line Numbers
  1. #nav
  2. {    
  3.     margin-left:30px;
  4.     font-size:8px;
  5.     background-color:#BABABA;
  6.     height:15px;
  7.     width:93%
  8. }
  9. #nav li
  10. {    position:relative;
  11.     float:left;
  12.     width:85px;
  13.     height:10px;
  14.     background-color:#BABABA;
  15.     border-right: 3px solid #625663;
  16.     border-bottom:2px solid #625663;
  17.     margin-top:1px;
  18.  
  19. }
  20. #nav li ul
  21. {/*hide the submenus from display*/
  22.  display:none;
  23. }
  24. #nav li:hover a
  25. {
  26.     background-color:#A5A0A8;
  27.     font-weight:bold;
  28.     color:White;
  29. }
  30. #nav li:hover ul
  31. {
  32.     display:inline;
  33.     width:auto;
  34.     height:auto;
  35.     margin-top:1px;
  36.     background-color:#A590A8;
  37.     float:left;
  38.     text-align:left;
  39.     line-height:10px;
  40. }
  41. #nav li:hover ul li
  42. {
  43.     margin-top:3px;
  44.     overflow:hidden;
  45.     background-color:Transparent;
  46. }
  47. #nav li:hover ul li a
  48. {
  49.     background-color:Transparent;
  50. }
  51. #nav li:hover ul li a:hover
  52. {
  53.     background-color:#A2A4B8;
  54.     display:block;
  55.     margin:0; padding:0;
  56. }
Attached Images
File Type: jpg HTMLhowToDoIt.jpg (67.8 KB, 367 views)
May 30 '11 #1
3 4998
JKing
1,206 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. #nav li:hover a
  2. {
  3.     background-color:#A5A0A8;
  4.     font-weight:bold;
  5.     color:White;
  6.     display:block;
  7. }
  8.  
By default anchors are inline elements and only take up as much space as necessary. Adding display:block; fixes this and expands the clickable area.
May 31 '11 #2
Brian Connelly
103 New Member
Thanks. That did the trick. What does inline do?
Jun 2 '11 #3
JKing
1,206 Recognized Expert Top Contributor
Inline elements take up only as much space as necessary and do not have line breaks before or after.
Jun 3 '11 #4

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

Similar topics

10
3466
by: Haines Brown | last post by:
I've implemented the horizontal drop down menu discussed recently in this newsgroup, and it works nicely under Galeon and Mozilla, but not IE 5.0. Here are the problems: Under IE 5.0, the there is no drop down menu functionality at all. I wanted to implement an alternative stylesheet for IE, but my link to it is apparently broken. What is wrong with my link? I'd
3
2972
by: Bilal | last post by:
Hi, I've been looking all over the net for a way to increase the size of a drop down menu without any success. Does anyone perhaps have a way to display 11-15 items on a menu without having recourse to: 1. scroll bar. 2. configuring IE 3. decreasing the size of the font. Here is the code I used for my Drop down Menu: ______________ <select style="background-color: #FFFFFF; width:300;" size="1"
1
2427
by: M.L. | last post by:
Hi NG, I hope someone in here is able to help me in this matter. The problem: I have created a Javascript drop-down menu which expands when moving the mouse into a tablecell (calls my Expand() function at onMouseover on the <td>-element). My question is now this: How do I delay the expansion of the menu for e.g. 500 ms in order to keep it from happening "by accident". A
3
1548
by: phil | last post by:
We are developing specs. for a website for a nonprofit org, with database for membership related functions. But..question is regarding drop down menu links. We will have 20 category-pages, and each page will have 30-50 links- unique to that page, so 1000+ total for site- on a drop down menu. Need we assume that such links (both plain english description to appear on site, and actual URL to link to- so 2 pieces data really for each...
3
4449
by: rsteph | last post by:
I have a javascript drop down menu that I borrowed from a website. It utilizes a little .css to help with formatting. The menu works great, and on all 3 of the browsers I'm concerned about; but I am having one problem. The menu, as designed, is a 1-tier menu (or is it 2-tier). It has the horizontal menu bar, along with the drop downs... but the drop downs aren't designed to propogate another menu (3rd teir). I was wondering if, but looking at...
4
9287
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me if it works, and if it does not, tell me why it does not work. Thanks.
1
2401
by: Kaland | last post by:
Do the search engines follow links that are within forms (like the drop-down menu) so that those pages are indexed? Here is the code for a sample drop-down menu that I created. <form><select name="menu" style="font-family:'Calligrapher';color:#993333;background-color:#FFFFFF;font-size:10pt;"><option value="http://www.localwebsolutions.com/local-business-marketing-online.html">Marketing Online</option><option...
4
14175
by: magmike | last post by:
I've got a control on my form that allows the user to select a record based on a form field (in this example, the drop down menu shows the company name, followed by the contact name but uses the contactid to change the data on the form). Most users, start typing the company name which will auto complete itself with the first entry with the letters typed so far. They can then click on the arrow to view the listings, select the one they want...
14
1578
by: adamjblakey | last post by:
Hi, I have a function here: var AdminResponse = ""; function parseResponse(){ var nText = AdminResponse.getElementsByTagName('optionText');
0
1389
by: poijoy | last post by:
I wanted to create a web page just for practice. One thing I want to do is create a drop-down menu for my blog page. Everything else (for page navigation) is in a menu bar across the top. The "blog" list needs to be within that menu bar. I can get the drop-down list to appear, but I cannot seem to figure out how to get the links to work. I can TRY to give y'all a quick look at what I've got. Maybe you can help me figure it out? <br />...
0
8312
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
8827
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...
1
8504
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8606
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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
4159
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...
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.