Adding ID to an anchor tag and referring it later in the context

I’m completely new into coding and so far I have finished some HTML5 basic courses. I then started to create a blog in order to put my knowledge into practice and learn by doing.

In this blog I created a navbar with some links at the top . These links I mentioned later in some of the articles and I was wondering if it’s possible to add an ID to the <a> tag in order to referred it every time I need it, like when referring to a div id with the #, instead of writing the whole path on the href.
I tried it like this, but it doesn’t work

<a href="./aboutme.html" target="_blank" id="aboutme">About me</a>
<p>Curious about who is behind this lines? Then check the
<a href="#aboutme" target="_blank">"About Me"</a> section.

Thanks in advance!

you can’t

this is going to append #aboutme to the current url and scroll to the element with that id. If you want to page to jump there this is the way to do it.

Otherwise, add a class to them, add the href with javascript dom

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

@ieahleen thanks a lot for your reply and the tips of how to write the code in the forum. As you can see I’m a complete beginner in this field.

I guess I will still using the ./ path for now until I learn javascript dom manipulation.

Again thanks a lot and have a nice day!