Aaaaa
Aaaaa

Reputation: 163

html anchoring tag

what is the meaning of this anchoring tag format

<A href="#some name">

Upvotes: 0

Views: 180

Answers (2)

biscuitstack
biscuitstack

Reputation: 12102

In layman's terms:

It is intended to link to a section of a page (specifically, it's usually a div or anchor named 'some name') rather than link to a new page. It can be used to link to a section of a new page other than the start also.

Upvotes: 0

Felix Kling
Felix Kling

Reputation: 816262

Should be more like

<a href="#some name">Some Text</a>

If you click on the link, the browser will automatically jump the element with id or name "some name", e.g.

<div id="some name">
    Some more text.
</div>

You will also see that the URL changes. The generic format of a URL is (more or less):

<scheme>://<host>/<path>?<query>#<fragment identifier>

The fragment identifier is what you are talking about to and it refers content inside the page. The href attribute above actually contains a URL, a relative one. That means, this URL should be interpreted relatively to the current URL.

If you current URL is

http://www.example.com/some/path

then clicking on the link will lead you to

http://www.example.com/some/path#some%20name

As already said, the fragment identifier refers to a part in the current page, so the browser does not reload the page but just jumps to that part.

Upvotes: 5

Related Questions