HTML Link Bookmarks Explained
Creating and Styling Link Bookmarks
Link bookmarks are used to create links that navigate to specific parts of the same page or other pages. This is done using the `id` attribute on elements and the `href` attribute with a hash (`#`) to point to those IDs.
Linking Within the Same Page
To create a link that jumps to a specific section within the same page:
<a href="#section2">Go to Section 2</a>
Explanation: Clicking this link will scroll the page to the element with the `id` attribute of `section2`.
Go to Section 1 Go to Section 2 Go to Section 3Section 1
This is the content of Section 1. It serves as a destination for bookmarks.
Section 2
This is the content of Section 2. It serves as a destination for bookmarks.
Section 3
This is the content of Section 3. It serves as a destination for bookmarks.
Linking to a Different Page
To create a link to a specific section on a different page:
<a href="another-page.html">Go to on Another Page</a>
Explanation: Clicking this link will navigate to `another-page.php` and scroll to the element with the `id` attribute of `section2` on that page.