Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my asp.net application,i have several menus and submenus,in it i have been asked to highlight the selected item in the menu using CSS,any one got any idea about it,please do share your idea
Posted

1 solution

This is not how it normally works. For CSS, the notion of "selection" is insignificant. To implement highlighting, you should handle some events of the DOM elements using JavaScript. In the event handler, you modify the style class of the element when it changes the state (for example, please see documentation on .addClass and .removeClass below). The most convenient way of doing it I know is jQuery.

Please see these CSS methods:
http://api.jquery.com/addClass/[^],
http://api.jquery.com/addClass/[^],
http://api.jquery.com/toggleClass/[^],
http://api.jquery.com/category/css/[^].

If you need to learn jQuery (I highly recommend it), please see:
http://en.wikipedia.org/wiki/JQuery[^],
http://docs.jquery.com/Tutorials:How_jQuery_Works[^],
http://docs.jquery.com/Tutorials[^].

—SA
 
Share this answer
 
v2
Comments
_Amy 31-Jul-12 2:33am    
Nice links. +5!
Sergey Alexandrovich Kryukov 31-Jul-12 11:14am    
Thank you, Amit.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900