Even tho we are more than sure you already know how to create a hyperlink (or else known simply as link) we at xHTML Coding decided that IF we are going to write HTML tutorial we are going to start from the roots up to the top. So no offense to whoever is already familiar with hyperlink.

What is a hyperlink

Hyperlink is a reference that links one page with other pages within the same website or with another existing website. The hyperlink is also known as navigation menu of the site.

Create hyperlinks

The HTML language uses the <a> (anchor) to create a link to another document. An anchor can link to any given document, a HTML file, an image an music file or even an compressed document or PDF file. Lets see how the code of a hyperlink looks like.

<a href=”secondpage.htm”>Second page</a>

The HREF attribute is used to address the document to link to, while the words between the open and closed anchor tag will display the hyperlink (also known as anchor text).

The target attribute
With the target attribute we can control the behavior of the visitors browser once he clicks our hyperlink. There are several attributes that we can apply to the anchor and control the behavior of the browser, lets line them up.

  • _blank
  • _top
  • _parent
  • _self

The _blank attribute will open the link in a new browser window (modern browser that support multiple tabs will open a new tab, depends on the browser settings). The _top attribute will break out of frame, if you are using layout with frames and want your visitors to break out the frame when they are being pointed to another document file or a new website. While _parent is used in the situation where a frameset file is nested inside another frameset file. A link in one of the inner frameset documents which uses _parent will load the new document where the inner frameset file had been. The _self attribute puts the new document in the same window and frame as the current document. This attribute works the same way as you did not placed a target attribute at all

The Name attribute
The name attribute is used to create a named anchor. When using named anchors we can create links that can jump directly into a specific section on a page, instead of letting the user scroll around to find what he/she is looking for. An example can be seen here.

The HTML Tutorial on Hyperlink terminates here. I hope you enjoyed this tutorial and it will be of your use if you a new to HTML language.

Comments are closed.