What is the purpose of hashtag in HTML Links?
Within a hyperlink, a hash –
'#' specifies an HTML element id to which the window should be scrolled.
href="#idname" would scroll to a current page element, such as
You might come across a link like this while working on a web page:
href="#" here is a placeholder.
href="#" doesn’t specify an id name, but does have a corresponding location – the top of the page. Clicking an anchor with
href="#" will move the scroll position to the top.
Tip: You can use
href="#" to link to the top of the current page!
Sometimes this can also indicate that the app is in development, and we’ll fill that link href attribute later.
Other times you’ll see this below:
In this case the link references a point or section in the same page.
You’ll have an element like this:
It can also be an empty element, which will be there, but hidden:
Notice we used
<a href="#about">About</a> element will bring you to the
<section> with the
id equal to about.
Want to learn more about HTML links? Then go check out HTML Links HyperLinks – W3Schools
What is HTML? Basics Explained
How to Create an HTML Boilerplate
What is an HTML Element? How do you create one?
If you liked this article, then please share. You can also find me on Twitter for more updates.