HTML Code for Hyperlink

Introduction to Hyperlinks in HTML

Hyperlinks, also known as links, are an essential part of web development. They allow users to navigate between different web pages by clicking on the anchor text or image. In HTML, hyperlinks are created using the <a> (anchor) tag.

Creating a Basic Hyperlink

To create a basic hyperlink in HTML, the <a> tag is used along with the href attribute to specify the destination URL. The text or image that users click on is placed within the opening and closing <a> tags.

Linking to External Web Pages

To link to an external web page, the href attribute of the <a> tag should contain the full URL of the destination page. This can be an HTTP or HTTPS link to a different website.

Linking to Internal Sections of a Page

Hyperlinks can also be used to direct users to specific sections within the same web page. This is achieved by providing the id of the target section as the value of the href attribute.

Example Code

<a href="https://www.example.com">Visit our website</a>

Go from files to website in seconds.

Start a free trial for 7 days — no credit card required

Get Started for Free