bleustreak12 Posted July 24, 2009 Share Posted July 24, 2009 how to apply a different css if one link is active or has a different id Quote Link to comment https://forums.phpfreaks.com/topic/167246-how-to-apply-a-different-css-if-one-link-is-active-or-has-a-different-id/ Share on other sites More sharing options...
jayjay960 Posted July 24, 2009 Share Posted July 24, 2009 Well thanks for that amazingly detailed and explanatory post (not just copying and pasting the title, and asking an actual question would be nice), but you need css for that. a:active { /*css*/ } a#id { /*css*/ } Quote Link to comment https://forums.phpfreaks.com/topic/167246-how-to-apply-a-different-css-if-one-link-is-active-or-has-a-different-id/#findComment-881813 Share on other sites More sharing options...
haku Posted July 24, 2009 Share Posted July 24, 2009 :active only applies to a link that has been clicked, not to links on the current page. Quote Link to comment https://forums.phpfreaks.com/topic/167246-how-to-apply-a-different-css-if-one-link-is-active-or-has-a-different-id/#findComment-881816 Share on other sites More sharing options...
bleustreak12 Posted July 24, 2009 Author Share Posted July 24, 2009 well i want to apply that css for other links so suppose i am on page 1 should have home link with a border if i am on page 2 i should have about with a border i want to run it through javascript Quote Link to comment https://forums.phpfreaks.com/topic/167246-how-to-apply-a-different-css-if-one-link-is-active-or-has-a-different-id/#findComment-881820 Share on other sites More sharing options...
RichardRotterdam Posted July 24, 2009 Share Posted July 24, 2009 Sound's like you want to highlight the active page in the navigation. I don't think you should use javascript for that purpose. You might want to read the following topic. http://www.phpfreaks.com/forums/index.php/topic,261426.0.html Quote Link to comment https://forums.phpfreaks.com/topic/167246-how-to-apply-a-different-css-if-one-link-is-active-or-has-a-different-id/#findComment-881827 Share on other sites More sharing options...
bleustreak12 Posted July 24, 2009 Author Share Posted July 24, 2009 not exactly the thing is i have two very different menus and what i am doing is that i show the second menu only when a certain menu item is selected in menu 1(and the second menu stays shows as long as no other menu item is selected in menu 1) so it appears that(the menu 2) it is its sub menu. now as long as the item in menu 1 is selected there is styling for that item but once i click on the item in menu 2 the menu 1 item style dissapears as it is not the one that is active. i hope i am clear i have two different menus and i want it to work as if there is one main menu and one sub menu Quote Link to comment https://forums.phpfreaks.com/topic/167246-how-to-apply-a-different-css-if-one-link-is-active-or-has-a-different-id/#findComment-881847 Share on other sites More sharing options...
RichardRotterdam Posted July 24, 2009 Share Posted July 24, 2009 Ah now the bigger picture is getting more clear which wasn't clear in your original post. It is still vague what you mean by "selected". Do you mean when you hover over a main navigation item? Do you have some code to show so far? Quote Link to comment https://forums.phpfreaks.com/topic/167246-how-to-apply-a-different-css-if-one-link-is-active-or-has-a-different-id/#findComment-881852 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.