Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the # convention used in empty anchor tag hrefs?

Tags:

html

I understand that it's a good idea not to leave empty anchor tags. In jQuery and other syntaxes I've noticed everyone typically uses a # to fill the gap (<a href='#'>anchor text</a>). Is this character any better or worse than filling it with anything else? (e.g. <a href='$'>anchor text</a>). I have no reason to want to do this, but seemingly no reason aside from convention to do it the other way either. Why is the # convention used in empty anchor tag hrefs?

like image 321
buley Avatar asked Dec 18 '10 16:12

buley


People also ask

Why is the skyblue?

The sky during the day During the day the sky looks blue because it's the blue light that gets scattered the most. It's redirected into many different directions all over the sky, whereas the other wavelengths aren't scattered as much.

Why is the sky bluer in some places?

That is because there is "less atmosphere" to scatter. And of course, some places on Earth are (always) at a different altitude... Show activity on this post. The blue color of the sky is due to Rayleigh scattering.

Is the sky really blue?

Our sky is actually purple Purple light has higher energy, and gets scattered more than blue. But the answer to why we see blue skies isn't a matter of physics; it's an answer for physiology.

Why is the sky blue in Class 10?

When a white light (from sun) enters the earth's atmosphere, it gets scattered away due to the atmospheric particles. Since, blue colour has the minimum wavelength, so blue colour scatters the most and thus the sky appears blue. Was this answer helpful?


1 Answers

This is because the # character in a URL references the local page.

It is used for named anchors (or any ID) within a page, so a link can jump directly to that area.

Wikipedia calls it the fragment identifier and has this to say:

The fragment identifier, if present, specifies a part or a position within the overall resource or document. When used with HTTP, it usually specifies a section or location within the page, and the browser may scroll to display that part of the page.


As a practical example - this link to wikipedia has a fragment identifier (always at the end of the URL):

http://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax

In the page, there is a <span id="Syntax" ... tag, and the browser jumps directly to it.

like image 81
Oded Avatar answered Oct 02 '22 16:10

Oded