Link to home
Start Free TrialLog in
Avatar of Steve Bohler
Steve BohlerFlag for United States of America

asked on

CSS question related to hyperlinks

Is it possible to style a hyperlink so that:

a) The hyperlink can be made non-clickable.
or
b) The style specifies a URL to override the a href declaration.

Thanks,
Steve
Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

Presuming straight HTML/CSS:
a) No.
b) No.

You could do something like that via javascript, or a back-end coding language (like ASP.Net).
ASKER CERTIFIED SOLUTION
Avatar of Russ Suter
Russ Suter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Begs the question if you can edit the HTML to add the class why not just remove the href ?
Yes, the acceptance of that as a solution makes no sense.
Avatar of Russ Suter
Russ Suter

How does the acceptance of the solution make no sense? It answers the questions asked. Whether or not the implementation is appropriate is a different topic.
Avatar of Steve Bohler

ASKER

I want to dynamically change the class of the a tag depending on certain factors. If a certain flag is set, I want the link to be inactive. No HTML editing.
I'm curious. If you're assigning a class to an element aren't you editing the HTML anyway? Or do you have some other way of setting the flag outside the HTML markup?
The flag will be set via a query to a database.
Which implies the page is generated? In which case why generate the link in the first place?