What Is a Hyperlink?

September 3, 2024

Hyperlinks are embedded references that enable seamless navigation between documents, websites, and different sections within a page.

what is hyperlink

What Is a Hyperlink?

A hyperlink, often referred to simply as a link, is a reference in a digital document that allows users to navigate from one location to another within the same document, across different documents, or to entirely different websites. This reference is typically embedded within text or an image and, when clicked, instructs the browser or application to load the specified destination. Hyperlinks are an essential component of hypertext, the system that enables non-linear navigation of information on the internet.

Link vs. Hyperlink

The terms "link" and "hyperlink" are often used interchangeably, but there is a subtle distinction between the two.

A "link" is a broad term that generally refers to any element in a document or webpage that connects to another location, which can include both text and images. On the other hand, a "hyperlink" specifically refers to a link embedded within hypertext, which is text displayed on a computer or digital device with hyperlinks that provide access to other text or information.

While all hyperlinks are links, not all links are considered hyperlinks. For instance, a URL typed in a plain text document is a link, but not a hyperlink until it becomes clickable within a hypertext system. In essence, a hyperlink is a more specific form of a link, designed to facilitate easy and interactive navigation within and between digital documents.

What Is the Purpose of Hyperlinks?

The primary purpose of hyperlinks is to facilitate easy and intuitive navigation between different pieces of digital content, whether within the same document or across multiple documents and websites. Hyperlinks enable users to access related information quickly, enhancing the overall user experience by providing a seamless way to explore interconnected resources. They serve as the foundation of the web's structure, allowing for the non-linear exploration of content, which is central to how the internet functions.

In addition to aiding navigation, hyperlinks are crucial for organizing and structuring information in a way that makes it more accessible and understandable. They connect relevant topics, provide additional context, and help users dive deeper into specific areas of interest without cluttering the primary content.

Hyperlinks also play a vital role in SEO (search engine optimization) by helping search engines index and rank content based on the relationships between linked pages, thereby influencing how information is discovered and prioritized in search results.

A Short History of Hyperlinks

The concept of hyperlinks has its roots in the early vision of hypertext, a system that allows text to be interconnected in a non-linear way. This idea was first articulated by Vannevar Bush in his 1945 essay "As We May Think," where he envisioned a machine called the "Memex" that would allow users to navigate between documents using linked associations.

The modern hyperlink took shape in the 1960s with the development of the Hypertext Editing System (HES) and later, the more advanced systems like Ted Nelsonโ€™s Project Xanadu, which aimed to create a global network of linked information.

The true breakthrough came in the late 1980s and early 1990s with the invention of the World Wide Web by Sir Tim Berners-Lee. He proposed the use of hyperlinks as a fundamental part of the webโ€™s architecture, allowing users to click on highlighted text or images to jump between related web pages. The first successful implementation of hyperlinks occurred with the release of Berners-Leeโ€™s web browser, WorldWideWeb, in 1991, which allowed users to explore the burgeoning web through clickable links.

Since then, hyperlinks have become a ubiquitous element of the internet, shaping how information is connected, accessed, and shared globally. They have evolved from simple text-based links to more sophisticated forms, including embedded multimedia and dynamic content, but their core purpose of linking information remains the same.

Hyperlink Types

Hyperlinks come in various forms, each designed to serve specific functions within digital content. Understanding the different types of hyperlinks is essential for effective web design and user navigation. Below is an explanation of the primary types of hyperlinks commonly used.

Text Hyperlinks

Text hyperlinks are the most common type, where clickable text (often underlined and in a different color) directs users to another location. These links are typically embedded in the body of a document or webpage and are defined by the HTML <a> tag, which includes the destination URL. When clicked, text hyperlinks allow users to navigate to a new page, a different section of the same page, or an external website.

Image Hyperlinks

Image hyperlinks are clickable images that function the same way as text hyperlinks. Instead of text, an image is used as the clickable element. These hyperlinks are useful for creating visually engaging navigation elements, such as buttons, banners, or icons that lead to other pages or resources when clicked.

Inline Hyperlinks

Inline hyperlinks are embedded within a block of text and are used to reference related content or provide additional information without disrupting the flow of reading. These links are often used in articles or documents to direct readers to sources, definitions, or extended explanations relevant to the main content.

Anchor Links (Jump Links)

Anchor links, also known as jump links, allow users to navigate to a specific part of the same webpage. These hyperlinks are particularly useful for long web pages, such as articles, FAQs, or one-page websites, where they enable quick access to different sections by jumping directly to the desired content.

Email Hyperlinks

Email hyperlinks open a user's default email client and create a new email message when clicked. These links are formatted using the mailto: URL scheme and are commonly used on websites to allow users to easily contact someone via email. The link can also include a pre-defined subject line or message body.

File Hyperlinks

File hyperlinks direct users to download a specific file, such as a PDF, image, or document. These links are often used in educational or professional settings where users need to access downloadable resources directly from a webpage. When clicked, the file is typically downloaded to the user's device.

External Hyperlinks

External hyperlinks direct users to a different website or domain than the one they are currently visiting. These links are essential for referencing sources, guiding users to additional resources, or directing traffic to partner sites. They usually open in a new browser tab or window to maintain the userโ€™s current browsing session.

Internal Hyperlinks

Internal hyperlinks connect different pages within the same website or domain. They are crucial for website navigation, helping users move between various sections or pages of a site. Internal links also play a significant role in SEO by improving the site's structure and helping search engines understand the relationship between different pages.

How to Create a Hyperlink?

Creating a hyperlink is a straightforward process that involves adding specific HTML code to your text or image to make it clickable, directing users to another location. Below is a step-by-step guide on how to create a basic hyperlink:

1. Choose the text or image. First, decide what text or image you want to turn into a hyperlink. This could be a word, phrase, button, or image that users will click on to navigate to another page or resource.

2. Write the HTML code. To create a hyperlink, you will use the HTML <a> tag (also known as the anchor tag). The basic syntax looks like this:

<a href="URL">Link Text or Image</a>
  • <a>. This tag defines the start of the hyperlink.
  • href="URL". The href attribute specifies the destination URL, which can be a webpage, file, or another section of the same page. Replace "URL" with the actual web address or file path.
  • Link text or image. This is the text or image that will be clickable. For a text hyperlink, simply place the desired text here. For an image hyperlink, place an HTML image tag (<img src="image-path">) inside the anchor tags.

3. Example of a text hyperlink. To create a text hyperlink that takes users to "http://example.com" when they click on the word "Example":

<a href="http://example.com">Example</a>

4. Example of an image hyperlink. To create an image hyperlink using an image located at "image.jpg" that links to "http://example.com":

<a href="http://example.com">

  <img src="image.jpg" alt="Description of Image">

</a>

5. Save and test. After writing your HTML code, save the changes and test the hyperlink in a web browser. Click the link to ensure it directs you to the correct destination.

Additional Attributes (Optional)

  • target="_blank". This attribute opens the link in a new tab or window.
  • title="Tooltip Text". Provides additional information about the link when users hover over it.

For example, to open the link in a new tab:

<a href="http://example.com" target="_blank">Example</a>

How to Link to a Different Page on the Same Site Using Relative URLs

Linking to a different page on the same site using relative URLs is an efficient way to create internal hyperlinks without having to specify the full web address. A relative URL points to a file or location within the same domain, allowing your site to function correctly even if the domain name changes. Hereโ€™s how to create such links:

Linking to a Page in the Same Directory

Imagine you have two HTML files, index.html and about.html, both located in the root directory of your site. To link from index.html to about.html, you would use:

<a href="about.html">About Us</a>

Linking to a Page in a Parent Directory

Suppose your current page is located in a subdirectory called blog, and you want to link to index.html located in the root directory. You would use:

<a href="../index.html">Home</a>

Linking to a Page in a Subdirectory

If you are linking from index.html in the root directory to post.html located in a blog subdirectory, your link would look like this:

<a href="blog/post.html">Read Blog Post</a>

How to Link to a Specific Section of a Page

Linking to a specific section of a page, also known as creating an "anchor link" or "jump link," is a useful way to direct users to a particular part of a webpage. This is especially helpful on long pages where you want to provide quick access to specific sections. Here's how you can create such links:

Step 1: Identify or create the target section

First, you need to identify or create an "anchor" in the section of the page you want to link to. This is done by adding an id attribute to an HTML element, such as a heading or a paragraph, where you want the link to jump to.

For example, if you have a section with the heading "Contact Us," you can add an id to the heading like this:

<h2 id="contact">Contact Us</h2>

Step 2: Create the link to the section

Next, you create a link that points to the id of the target section. This is done using a relative URL that includes the # symbol followed by the id value.

To link to the "Contact Us" section from elsewhere on the same page, the HTML code would look like this:

<a href="#contact">Go to Contact Us</a>

Step 3: Linking from another page

If you want to link to a specific section from a different page on the same site, you include both the page URL and the id in the link. For instance, if the "Contact Us" section is on a page called about.html, the link would look like this:

<a href="about.html#contact">Go to Contact Us</a>

Example in Practice

Consider a scenario where you have a page with different sections like "Introduction," "Services," and "Contact Us." Hereโ€™s how you might set it up:

<h2 id="intro">Introduction</h2>

<p>Welcome to our website...</p>

<h2 id="services">Services</h2>

<p>We offer a variety of services...</p>

<h2 id="contact">Contact Us</h2>

<p>You can reach us at...</p>

Navigation Links

<nav>

  <ul>

    <li><a href="#intro">Introduction</a></li>

    <li><a href="#services">Services</a></li>

    <li><a href="#contact">Contact Us</a></li>

  </ul>

</nav>

How to Open a Link in a New Tab

To open a link in a new tab, you need to add the target attribute with the value _blank to the HTML <a> tag. This tells the browser to open the linked document in a new tab rather than in the same tab as the current page. Hereโ€™s how you can do it:

<a href="URL" target="_blank">Link Text</a>
  • href="URL". This attribute specifies the URL of the page or resource you want to link to.
  • target="_blank". This attribute and value tell the browser to open the link in a new tab.

Anastazija
Spasojevic
Anastazija is an experienced content writer with knowledge and passion for cloud computing, information technology, and online security. At phoenixNAP, she focuses on answering burning questions about ensuring data robustness and security for all participants in the digital landscape.