473,503 Members | 2,174 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 4971
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
3443
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...
3
2953
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...
1
2418
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()...
3
1539
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...
3
4437
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...
4
9272
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...
1
2391
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...
4
14162
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...
14
1570
by: adamjblakey | last post by:
Hi, I have a function here: var AdminResponse = ""; function parseResponse(){ var nText = AdminResponse.getElementsByTagName('optionText');
0
1386
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"...
0
7093
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...
0
7287
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
7349
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...
1
7008
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
7467
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...
0
5594
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,...
1
5022
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...
0
4688
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...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.