I do not know how to mark the link of the page on which you are. That is, for example, there are 3 links. Home, Page 1, Page 2. When you entered the main page, an underline appeared at the link leading to the main page. When I went to Page 1, the link leading to Page 1 had an underscore, and so on.

  • a reference to itself - [Lebedev indignant] [1]. The menu needs to be generated with links to other pages, and where there was a link to the current page you can show it, but you shouldn’t make a link (and how you select it will depend on you). [1]: artlebedev.ru/kovodstvo/sections/75 - Yura Ivanov

1 answer 1

I will show the example of the menu. Example html:

<div id="mainmenu"> <ul> <li><a href="#" class="selected">Элемент 1</a></li> <li><a href="#">Элемент 2</a></li> <li><a href="#">Элемент 3</a></li> </ul> </div> 

Next, decorate the links as we want with CSS. Example:

 #mainmenu a { color: red; text-decoration: underline; } 

And we write CSS for the link that we want to highlight (for example, we’ll have not red, but blue, underlined, and clicking on it will not happen (this is logical)):

  #mainmenu a.selected { color: blue; text-decoration: none; pointer-events: none; } 

It remains only to add the attribute class to the link that was clicked and remove it from the unnecessary one. This needs to be done with jscript (or jquery). Here you can read (with examples) how it is done using jquery

  • one
    And the href parameter for such a link can be removed, then it will stop responding to the mouse - sercxjo