What is it when a link has a pound "#" sign in it

It's a "fragment" or "named anchor". You can you use to link to part of a document. Typically when you link to a page, the browser opens it up at the top of the page. But you link to a section half-way down, you can use the fragment to link to that heading (or whatever).

If there is no <a name="whatever"/> tag within the page, then the browser will just link to the top of the page. If the fragment is empty, then it will also just link to the top of the page.

For a fragment only <a href="#">Link name</a>, then that's just a link to the top of the current page.

You often see that kind of link used in conjuction with javascript. Standards compliant HTML requires a href attribute, but if you're planning to handle the request with javascript then "#" serves as a reasonable place holder.


... just to add a few extra useful tips.

You can access and change it with document.location.hash in JavaScript.

It can point to a named anchor (e.g. <a name="top"></a>) or to an element with a corresponding id (e.g. <div id="top"></div>).

Seeing one on its own (e.g. <a href="#" onclick="pop()">popup</a>) generally means a link is being used to run JavaScript exclusively. This is bad practice.

Any a element should have a href that points to a valid resource. If one does not exist, consider using another element, such as button.

Tags:

Html