HTML links are the hyperlinks i.e. links are those text/ buttons by which we can go to another page/website by clicking on it.

We can also use images as a link.

Syntax:

<a href="#">Text</a>

Links are written using <a> tag and has href as its attribute. Users can click on anything between the opening <a> tag and the closing <a> tag.

The value of this attribute is the address of the website that is reached when the user clicks on hyperlinked text.

  1. When you link to a different website, the value of the href attribute will be the full web address for the site, which is known as an absolute URL.
  2. When you are linking to other pages within the same site, you do not need to specify the domain name in the URL. You can use shorthand known as a relative URL.
  3. If all the pages of the site are in the same folder, then the value of the href attribute is just the name of the file.
  4. When linking to the same page ‘#’ value is used.

Links can be made more attractive by using CSS or by using style attribute such as color, background color, hover properties, text transform etc.


HTML link colors:
By default, a link will appear like this:

  1. An unvisited link is underlined and blue.
  2. A visited link is underlined and purple.
  3. An active link is underlined and red.

We can change the default colors by using CSS.

 

The target attribute:

It specifies where to open the linked document. The target attribute can have one of the following values:

  1. _blank – opens the linked document in new window or tab
  2. _self – opens the linked document in the same window or tab as it was clicked.
  3. _top – opens the linked document in the full body of the window.
  4. _parent – opens the linked document in the parent frame.

Report Error/ Suggestion

Related Posts:

[yuzo_views]











CopyRight © 2019

CopyRight © 2019