Links and Bookmarks

HTML links allow you to create hyperlinks that allow users to navigate between web pages. You can create a link to another webpage using the <a> element, and specify the destination URL using the href attribute.

Here is an example of how to create a link to another webpage:

<a href="https://www.example.com">Click here to visit example.com</a>

You can also create a link to a specific section of the same webpage using the id attribute and a fragment identifier. A fragment identifier is a name preceded by a # symbol that refers to a specific element on the page.

Here is an example of how to create a link to a specific section of the same webpage:

<a href="#section2">Go to Section 2</a>
...
<h2 id="section2">Section 2</h2>

HTML bookmarks allow you to create links that allow users to jump to specific sections of the webpage. To create a bookmark, you can use the id attribute on the element that you want to bookmark, and then create a link to the bookmark using the <a> element and a fragment identifier.

Here is an example of how to create a bookmark and a link to it:

<a href="#section2">Go to Section 2</a>
...
<h2 id="section2">Section 2</h2>

Bookmarks are often used to create a table of contents for a webpage, where each item in the table of contents is a link to a specific section of the page.

<h1>Table of Contents</h1>
<ul>
  <li><a href="#section1">Section 1</a></li>
  <li><a href="#section2">Section 2</a></li>
  <li><a href="#section3">Section 3</a></li>
</ul>

<h2 id="section1">Section 1</h2>
<p>Content for Section 1</p>

<h2 id="section2">Section 2</h2>
<p>Content for Section 2</p>

<h2 id="section3">Section 3</h2>
<p>Content for Section 3</p>

To create a bookmark, you can use any element that supports the id attribute, such as a heading, paragraph, or div element.

results matching ""

    No results matching ""