How to assign and use anchor HTML?

Today's topic will be anchored HTML.This element allows quick transitions inside pages and to external documents.Anchors are often used by web developers.Since they help organize a reader-friendly site.The article will be given a detailed description and examples of this element effectively.

Description

Anchor HTML - it's kind of a unique bookmark a web page.He always has an individual name that should not be repeated on the same page.The main purpose of an anchor - a quick transition from one part of a document to another, to a specific location.A special element of the effectiveness of this brings, when the web page is larger.Because of this, users uncomfortable to read the contents of the site.And the anchor in the HTML page allows for quick transition.

Assignment

To create a bookmark on the page you can use two different methods.The first is to use the attribute Name, and in the second case it is necessary to use an attribute ID.Next we will look at each method individually.The transition in both cases using the tag «a», which attribute contains the name or identifier.For example: «a href =" # footer "».The # symbol tells the browser that the link will bring anchored.

Name

Name attribute is specifically designed to create an anchor on a page.Its value can be any text.This HTML anchor may only be used in conjunction with the tag «a».

example you want to create a bookmark at the end of your page.You need to put the tag «a name =" footer "» «/ a» in the desired part of a web document.In another area of ​​the page you need to create a link to the anchor, add an entry for this «a href =" # footer "» link «/ a».By clicking on the item browser automatically takes you to that part of the document, which is tab Footer.

ID

To get started is to say that ID - an identifier that does not have a direct purpose to create anchors.But it allows you to create bookmarks in the entire area of ​​the document without creating additional links.That is, you can use the ID attribute to any element of HTML.Then, using the tag «a» refer to it.Here is an example: an element of «p» is in the middle of the document.To go to it from the beginning of the page without using the scroll bars, add an attribute ID: «p id =" centr "» «/ p».Then create a link: «a href =" # centr "» Text «/ a».Thus, we have easy access to any part of the document.The value of an ID attribute can be any text.

Effective use

In HTML link anchor is very often used for the construction of the navigation instrument.For example, the page has a huge amount of text information, which is in turn divided into separate paragraphs or chapters.To visitors it was convenient to use the site for a quick transition to a separate part of the document you want to assign the bookmark.To this end, each chapter create a link anchor, or use the ID identifiers.A top navigation bar will do with the content of all links.An interesting fact is that the anchor can be invoked from other Web pages.It is enough to add to the end of the reference value of the attribute Name or ID.Do not forget to add the # symbol.The scheme in this case would seem to be the main link # name (id).

Conclusion

Anchor HTML - it's very useful, and in some cases even necessary element.In this article I have presented only one example of its effective use.But in fact this kind of bookmarks can be used in many situations.The main thing - to understand their basic idea.