Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html

How to add a link in text in HTML

Syed Hussain

Overview

HTML lets users navigate through the web pages using HTML links. One of the options that HTML provides to users is to add links to text.

Syntax

The <a> tag is used for creating a link in HTML, followed by the href property containing the redirected path.

Any text occurring between the opening and closing of this tag acts as a link to a URL.

  • HTML
Text link in HTML

Types of links in HTML

HTML caters to two types of links:

Absolute links

Links that require the complete URL of a web page are known as absolute links. These are the pages that are usually considered external to the website. In the examples below, target represents the way a link opens in the browser.

<a href="https://www.google.com" target="_blank">Absolute Link Text.</a>
Linking text with a complete URL as seen from the format

Relative links

Links that are local to the website are known as relative links. These usually refer to web pages that are already present in the directory in which the website resides.

<a href="home.html" target="_blank">This text will redirect the user to the home page of the website.</a>
Linking text to a web page, present in the same directory of the current page, without the "https://www" format

Title property

The title property provides additional information related to the link used in href. This information is visible when the mouse hovers on the link.

  • HTML
Adding additional information to the link

RELATED TAGS

html
RELATED COURSES

View all Courses

Keep Exploring