Course Content
HTML Forms
HTML forms are an essential part of web development and provide a way for users to input and submit data to a server. Forms allow users to enter data such as text, numbers, checkboxes, radio buttons, and more. When a user submits a form, the data is typically sent to a server for further processing.
0/6
HTML Graphics
HTML provides various ways to incorporate graphics into web pages.
0/2
HTML Media
HTML provides built-in support for embedding and displaying various types of media content on web pages.
0/5
HTML APIs
HTML APIs, also known as browser APIs or web APIs, are a set of interfaces and methods provided by web browsers to interact with and manipulate web content, access device features, and perform various tasks. These APIs are implemented in JavaScript and are accessible to web developers when creating web applications. Here are some commonly used HTML APIs:
0/5
HTML Examples
Creating a Simple Web Page, Adding Links and Images and more
0/4
HTML5 for Free | HTML5 – Unleashing the Potential of Web Development
About Lesson

In HTML, you can create bookmarks or anchor links that allow users to navigate to specific sections within the same page. By using the id attribute to mark the target section and adding an anchor link with the href attribute set to the corresponding id, you can create bookmarks. Here’s how you can create bookmarks in HTML:

  1. Create a Target Section:
    Assign an id attribute to the section you want to create a bookmark for.

Example:

<h2 id="section1">Section 1</h2>
<p>This is the content of section 1.</p>
  1. Create an Anchor Link:
    Create a link with the href attribute set to # followed by the id value of the target section.

Example:

<a href="#section1">Go to Section 1</a>

The href value #section1 corresponds to the id attribute value of the target section. When users click the link, the browser will scroll to the section with the specified id on the same page.

You can create multiple bookmarks and anchor links within the same page by following the same pattern. Just make sure that the id values and the href values match.

Here’s a complete example with multiple sections and bookmarks:

<h2 id="section1">Section 1</h2>
<p>This is the content of section 1.</p>

<h2 id="section2">Section 2</h2>
<p>This is the content of section 2.</p>

<h2 id="section3">Section 3</h2>
<p>This is the content of section 3.</p>

<a href="#section1">Go to Section 1</a>
<a href="#section2">Go to Section 2</a>
<a href="#section3">Go to Section 3</a>

When users click on the “Go to Section X” links, the browser will scroll to the respective sections on the same page.

Using bookmarks or anchor links within a page can be helpful for long content, table of contents, or creating navigation within a single-page website.

Join the conversation