How do you link within a page in HTML?


A link is a connection from one Web page to another web page.

We can add page links to a web page. HTML links are hyperlinks. The <a> tag defines a hyperlink and is used to link from one page to another. href attribute is used with the <a> tag, which indicates the link's destination.

To create page links in an HTML page, we need to use the href attribute of the <a> and </a> tag. Make sure that the <a></a> tag is placed with in the <body>…</body> tags.

The link text is visible. Clicking on the link text will navigate to the specified URL address. By default, links will appear as follows on the web page of the browser.

  • An unvisited link is underlined and blue

  • A visited link is underlined and purple

  • An active link is underlined and red

Syntax

Following is the syntax to make a page link on the web page.

<a href="https://www.Google.com/"> text of the link </a>

Example

Following example program to make a page link on the web document.

<!DOCTYPE html> <html> <body> <h2>HTML Article on Links </h2> <p><a href="https://www.Google.com/">Click this to navigate to the Google home page</a></p> </body> </html>

Following is the output for the unvisited link. When we click on the link it will navigate us to the home page of the google search engine. Thus, the link will get visited and appear underlined and purple.

Example

In the example below, we linked the official page of tutorialspoint on the web document.

<!DOCTYPE html> <html> <head> <title>HTML Links</title> </head> <body> <h2>Click the link below and navigate the official page of tutorialspoint</h2> <a href="https://www.tutorialspoint.com/index.htm">TUTORIALSPOINT</a> </body> </html>

If we click on the link it will redirect you to the destination page. When we click on the link it will navigate us to the home page of the webpage of tutorialspoint.

We can add an image as link and other HTML elements as a link.

Syntax

Following is the syntax to add an image as a link on the web page.

<a href="link address"><img src="image destination"></a>

Example

Following is the example program to make an image as a link.

<!DOCTYPE html> <html> <body> <h2>HTML Article on Links </h2> <p><a href="https://www.Google.com/"><img src="https://www.tutorialspoint.com/javafx/images/javafx-mini-logo.jpg" style="width:50px;height:50px;"></a></p> </body> </html>

Following is the output for the image as a link, clicking on the image will navigate us to the google home page.

How do you link within a page in HTML?

Updated on 11-Nov-2022 07:53:39

  • Related Questions & Answers
  • How to add a base URL for all the links in a page in HTML?
  • How to link jQuery in HTML page?
  • How to create headings in HTML page?
  • How to create Paragraphs in HTML Page?
  • How to Insert Hyperlink in HTML Page?
  • How to draw circle in HTML page?
  • How to add video in HTML page?
  • How to make a page redirect using jQuery?
  • How to make the web page height to fit screen height with HTML?
  • How to redirect from an HTML page?
  • How to Insert an Image in HTML Page?
  • How to use title tag in HTML Page?
  • How to use href attribute in HTML Page?
  • How to use floating image in HTML page?
  • How to count the total number of links in a page in Selenium?

How to link to a specific part of a page.
Give a title to the text you'd like to link. First, make a title or name to the text you'd like to link on your webpage. ... .
Put the title into an opening HTML anchor link tag. ... .
Insert the anchor tags around the text you want to link to. ... .
Create a hyperlink that leads you to the text..
Use the #id selector from another page You can also jump to a specific part of another web page by adding #selector to the page's URL.
To create a link that opens directly to highlighted text:.
On your computer, open Chrome..
Go to a page with text you want to share..
To highlight the text you want to share, click and hold, then drag your mouse..
To open the context menu, right-click on the highlighted text..
Select Copy link to highlight..