Resources | Subject Notes | Information Communication Technology ICT
This section explains how to create a bookmark within a webpage using the id
attribute. Bookmarks allow users to quickly navigate to specific sections of a long webpage.
id
AttributeThe id
attribute is used to give a unique name to an HTML element. This name can then be used to link to that specific element from other parts of the page or from external links.
id
attribute to the starting element of that section.#
symbol followed by the id
.Element | Purpose |
---|---|
Starting Element | The HTML element that marks the beginning of the bookmark section (e.g., a , , etc.). |
id Attribute |
Assigns a unique name to the starting element. |
Bookmark Link | A hyperlink that points to the element with the specified id . |
Here's an example of how to create a bookmark:
This is the introduction to the webpage.
Some other content here...
More content...
In this example, the element containing the introduction text has the
id
attribute set to "introduction"
. The tag with the
href
attribute set to "#introduction"
creates a link that will scroll the user to the element with the
id
"introduction"
when clicked.
Bookmarks are useful for making long webpages easier to navigate. Users can quickly jump to the section they are interested in by clicking on the bookmark link.
Ensure that the id
attribute is unique within the entire HTML document. Avoid using spaces or special characters in id
names. The id
attribute should always be unique within a single HTML document.