Skip to main content
almarefa.net

Back to all posts

How to Create A Hyperlink In HTML?

Published on
4 min read
How to Create A Hyperlink In HTML? image

Best HTML Tools to Buy in October 2025

1 HTML and CSS: Design and Build Websites

HTML and CSS: Design and Build Websites

BUY & SAVE
$10.78 $29.99
Save 64%
HTML and CSS: Design and Build Websites
2 Funny Editor Definition Film Editor In Chief Video Editing T-Shirt

Funny Editor Definition Film Editor In Chief Video Editing T-Shirt

BUY & SAVE
$16.99 $19.99
Save 15%
Funny Editor Definition Film Editor In Chief Video Editing T-Shirt
3 HTML and CSS QuickStart Guide: The Simplified Beginners Guide to Developing a Strong Coding Foundation, Building Responsive Websites, and Mastering ... of Modern Web Design (QuickStart Guides)

HTML and CSS QuickStart Guide: The Simplified Beginners Guide to Developing a Strong Coding Foundation, Building Responsive Websites, and Mastering ... of Modern Web Design (QuickStart Guides)

BUY & SAVE
$24.49 $41.99
Save 42%
HTML and CSS QuickStart Guide: The Simplified Beginners Guide to Developing a Strong Coding Foundation, Building Responsive Websites, and Mastering ... of Modern Web Design (QuickStart Guides)
4 Mission HTML (Mission: Code (Alternator Books ® ))

Mission HTML (Mission: Code (Alternator Books ® ))

BUY & SAVE
$10.99
Mission HTML (Mission: Code (Alternator Books ® ))
5 Dynamic HTML: The Definitive Reference: A Comprehensive Resource for XHTML, CSS, DOM, JavaScript

Dynamic HTML: The Definitive Reference: A Comprehensive Resource for XHTML, CSS, DOM, JavaScript

BUY & SAVE
$63.31
Dynamic HTML: The Definitive Reference: A Comprehensive Resource for XHTML, CSS, DOM, JavaScript
6 DESARROLLO WEB CON HTML 5

DESARROLLO WEB CON HTML 5

BUY & SAVE
$32.00
DESARROLLO WEB CON HTML 5
7 Construindo Sites Com Css e (X)Html: Sites Controlados por Folhas de Estil

Construindo Sites Com Css e (X)Html: Sites Controlados por Folhas de Estil

BUY & SAVE
$38.08
Construindo Sites Com Css e (X)Html: Sites Controlados por Folhas de Estil
8 Programe juegos con HTML5

Programe juegos con HTML5

BUY & SAVE
$19.98
Programe juegos con HTML5
9 Learn HTML The Most Engaging Way (For Beginners): Includes Illustrations of Web Browser and Code Editor

Learn HTML The Most Engaging Way (For Beginners): Includes Illustrations of Web Browser and Code Editor

BUY & SAVE
$9.59
Learn HTML The Most Engaging Way (For Beginners): Includes Illustrations of Web Browser and Code Editor
10 Dear Editor

Dear Editor

BUY & SAVE
$3.99
Dear Editor
+
ONE MORE?

To create a hyperlink in HTML, you can use the tag along with the href attribute. The href attribute specifies the destination URL or the file path you want to link to.

Here is an example of HTML code to create a hyperlink:

Click here

In the above code, the text "Click here" will be displayed as a clickable link. When clicked, it will take the user to the URL specified in the href attribute, which, in this case, is "https://example.com".

You can also link to local files by providing the file path instead of a URL. For example:

Download file

In this case, clicking on the link will prompt the user to download the file "file.pdf" from the specified file path on the server.

Additionally, you can add a target attribute to specify how the linked page should open. For example, you can set it to "_blank" to open in a new browser tab or window:

Open in new tab

This will cause the linked page to open in a new browser tab or window when clicked.

By using the tag and the href attribute, you can easily create hyperlinks in HTML to connect your web pages and files.

A hyperlink in HTML is a mechanism that allows users to navigate and link to different sections or pages within a website or to external websites. It is typically displayed as clickable text or an image that, when clicked, directs the user to another location specified by its URL (Uniform Resource Locator). Hyperlinks are created using the <a> (anchor) tag and the "href" attribute to specify the destination URL.

To create a hyperlink that scrolls to a specific point on the current page in HTML, you can make use of HTML anchor tags along with some CSS and JavaScript code.

Here's an example:

  1. Add an ID to the element you want to scroll to. This can be any HTML element such as a heading or a specific section.
  1. Create the hyperlink that will trigger the scroll.

Go to Section 1

In this example, the href attribute is set to #section-1, which matches the ID of the element defined in step 1.

  1. Apply some CSS to ensure the scrolling effect is smooth.

html { scroll-behavior: smooth; }

  1. (Optional) If the smooth scrolling effect is not supported by all browsers, you may need to add a JavaScript polyfill. You can use the smoothscroll polyfill by adding this JavaScript code in the section of your HTML code.

That's it! With these steps, you should now have a hyperlink that scrolls to a specific point on the current page when clicked.

To create a hyperlink that opens a PDF document in HTML, you can use an <a> tag with the href attribute pointing to the URL of the PDF file. Here is an example:

Open PDF Document

Replace path/to/your/pdf/document.pdf with the actual file path or URL of your PDF document.

If your PDF file is in the same directory as your HTML file, you can simply specify the file name:

Open PDF Document

Additionally, if you want the PDF document to open in a new browser tab or window, you can add the target="_blank" attribute to the <a> tag:

Open PDF Document

This will ensure that the PDF document opens in a new tab or window instead of replacing the current page.

To create a link to download a file in HTML, you can use the <a> (anchor) element with the download attribute. Here is an example:

Click here to download the file

Replace "path_to_your_file" with the actual path to your file. Additionally, you can provide a custom name for the downloaded file by adding a value to the download attribute like this:

Click here to download the file

Replace "custom_filename" with the desired name for the downloaded file.