Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS On load change css/hyperlink Re: On load change css/hyperlink

#108464
Billy
Participant

I usually just give the <body> a class on each page, which is matched on the links. You then have this for example:
HTML

 ...  ... 

PHP

CSS

body.home li.home a,
body.contact-us li.contact-us a,
body.about-us li.about-us a {
color: grey;
cursor: default;
font-weight: bold;
}

So this is the most basic way to do it. The only problem is that the hyperlink does not go away (that could be done in JavaScript, but it would be too much work for such a trivial thing), but the cursor pretends there isn’t one there, which’ll dissuade the user from clicking it hopefully. And if they do, well they only reload the page.