Sunday, March 17, 2013

How to make selected menu option active by using css

Lets take an example if we are using jsp for menu and we have four pages and every page is using same menu so we have created a single menu page and all other pages are using that menu with the help of jsp:include tag.

Now we want our each menu option be active on click and we don't want to use js(javascript).

So here is a solution of this problem :
CSS code:

HTML or JSP code:

After including jsp code in each menu required page you need to give id in <body id=""> tag as shown below and that id will be different for each menu page.

No comments:

Popular Posts