Links in HTML

What’s a Link?

A link leads ( or re-directs ) you from one location to a next and can be classified as either internal or external.

Internal simply means on the same web page or web site. An external link on the other hand points to another website.

Constructing a Link

Links are created by using the anchor, <a> tag. An href attribute needs to be specified for the link to be defined.

<a> Click Here To Go To New2HTML </a>

The href Attribute

The href attribute specifies the direction for a link. When a link is clicked, the browser is redirected to the location specified by this attribute. Without the href attribute a link is basically useless.

<a href=""> New2HTML Website </a>

Here’s the output:
New2HTML Website

The title Attribute

The title attribute allows you to provide a title/description for a link. This title can be seen whenever the mouse is placed over the link.

<a href="" title="visit my website"> New2HTML Website </a>

The target Attribute

The target attribute specifies how the link should be opened. The values for the target attribute are, _self and _blank.

The _self value opens the link within the same browser window. The _blank value opens a completely new browser window.

If no target attribute is specified, links are opened within the same window.

<a href="" title="visit my website" target="_blank">; New2HTML Website </a>

That’s pretty much it for links! Go ahead and start practicing.