Home / Internet / How to Add a Text Link using Html

How to Add a Text Link using Html

Web page links or hyperlinks are what connects one part of the internet to another by enabling navigation either to another page or to an external website. A hyperlink is usually a different colour from the rest of the text on the page and it may also be underlined. A list of hyperlinks can be often seen to the side of a web page as part of a side panel to help internal navigation. A website may also contain hyperlinks in a menu bar under the page banner.

To add a hyperlink to a HTML document the tag is used along with the href attribute. The syntax looks like this:

Helium.com

The name of the link is added after the closing bracket containing the URL , followed by a closing tag. The name of the hyperlink can be anything, in fact it is common to use a small but relevant amount of text from the web page to maintain a natural appearance.

The value of the href attribute can be either a HTTP or FTP URL depending on what you intend to link to.

A standard hyperlink as in the example above would take the visitor away from the page they were viewing, but it is possible to make a hyperlink open another window. To do this the attribute target_”blank” is added to the tag:

Helium.com

+ USING A MAILTO HYPERLINK +

Hyperlinks can also be used to send feedback to the website owner by opening an email application. When the visitor clicks on the mailto hyperlink it opens their default email client and automatically adds the email address to the relevant field. The syntax for a mailto hyperlink is as follows:

Contact me

If an email address is to be added to a website it is advisable to disguise it from search bots used by spammers. One way to do this is to replace the ‘@’ with ‘@’. The above email address would become:

Contact me

This is not a foolproof method because some search bots include the ‘@’ in their search, and there are other more reliable means of disguising an email address.

+ DEFINING A BASE URL +

Usually when a hyperlink to another HTML document is added to a web page the URL is needed to specify its location. However, if the HTML document is stored in the same directory as the web page, then just its name can be used.

If the a HTML document is stored in another directory of your website then a tag is added between the tags. The syntax for using this is:

+ INTERNAL HYPERLINKS +

As well as using hyperlinks to navigate from one page or website to another they can also be used to move to another section of the same web page. A typical example of this would be a ‘return to top of page’ hyperlink.

To create an internal hyperlink the name attribute is used with the tag in the page section you want to link to. The tag and the name attribute will not contain the link, but adds an anchor for the link:

some text

Further down the page where you want to add the internal hyperlink that will, in this example return the visitor to the top of the page, add the tags along with the href attribute, followed by a hash (#) and include the name of the anchor:

Return to top of page

As well as guiding visitors around one page, it is also possible to use this technique to link to another named section on another page of a website.

Hyperlinks are an essential part of any website and form the structure of the whole internet. Rather than just linking web pages or websites they also have a necessary role within the internal structure of each website.

About User Lin