Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

Making a link inactive?

How to make a link appear the same in style as other links, but be inactive



11:44 am on Jul 11, 2003 (gmt 0)

10+ Year Member


I'm working on a dynamic menu (created with PHP) and using CSS to define the styles, but there's a question that may probably be pure HTML, suited to this forum.

I'm making my menu such that the menu link for the current displayed page is to become inactive, so that users don't waste bandwidth accidentally reloading the same page. I would like the link to appear in a different colour also to indicate clearly that this is the menu item being displayed in the content area of the page.

What is the best way to define the menu item? One way is to change the link from:

<a href="thispage.html">This Menu Item</a>


<a class="red_highlighted" >This Menu Item</a>

Because removing the href attribute renders the link inactive, and I can define a CSS class to give a different colour, hover, etc.

The other way is simply to change the link to something else:

<h1 class="red_highlighted">......

Is there a prefered solution? Is there a solution which allows the menu item to look more like a link - in so far as the mouse pointer will still change to the hand icon when hovering over the inactive link? If I use either of the two methods above, the mouse icon does not change to the hand when over the inactivated link/h1. So, can one create a link with the appropriate mouse hover icon but with no link activity?




11:55 am on Jul 11, 2003 (gmt 0)

WebmasterWorld Senior Member blobfisk is a WebmasterWorld Top Contributor of All Time 10+ Year Member

I think that if you want the link to be in inactive, remove the <a>nchor from it altogether. As for styling it, why not just emphasise it to flag that this is the currently selected/active page?


11:57 am on Jul 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

You need to set your CSS to change these values.




10:27 pm on Jul 11, 2003 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

>> <a class="red_highlighted"> <<

You should choose names based on what it does, not what it looks like!

If you wanted that "link" in green next week, then the code saying class="red" is just going to be confusing.

Change it to something like class="linkdisabled" or something.


Featured Threads

Hot Threads This Week

Hot Threads This Month