HTML Hyperlinks

You can redirect a user to another page or website when click using hyperlinks. A text, image or element that will have a hyperlink should be inside the <a> tag. The <a> element has an href attribute that you will write the url to be linked.

<a href="https://javapointers.com/html/creating-hyperlinks">
This is a hyperlink
</a>

A hyperlink text will be underlined and will have a color of blue by default (you can change its design using CSS). The <a> tag also contains target attribute that will determine where will be the url opened to. The following are the list of target attribute that you can use.

  • _blank – this will open the linked document in another tab or window.
  • _self – this is the default behavior and will open the document where it was clicked.
  • _parent – this will open the document in the parent frame.
  • _top – this will open the document in the body of the window.
  • framename – this will open the document in a frame with the same name defined.
<a href="https://javapointers.com/html/creating-hyperlinks"
target="_blank">
This is a hyperlink that will open in new tab/window.
</a>
Share this tutorial!