Id attribute
The HTML id attribute assigns an identifier to an element, intended to be unique within its document.
Web Components in Action
An HTML attribute that assigns an identifier to an element for document and selector-based addressing.
- How it is used
- Uses unique IDs for document-wide addressing, but uses classes for component-scoped template and element lookup.
- How deep it goes
- Explains uniqueness and selector replacement through template loading, stopping short of broader selector syntax.
- Examples
- Demonstrates default-card templates and slider elements migrated from id selectors such as bg-overlay and thumb to classes.
- What you can do after
- Apply it via DOM selectors by choosing document-wide IDs or component-scoped classes for template and element addressing.
WordPress Power Toolkit: Harness AI to build next-level websites
An id attribute assigns a unique identifier to an HTML element so it can be targeted within a document or by a link.
- How it is used
- Targets a specific paragraph or heading when building hyperlinks that jump within a page.
- How deep it goes
- Demonstrates placing an id in a paragraph tag and combining it with a permalink fragment, without broader HTML internals.
- Examples
- Uses a Mexican recipes page, its second paragraph, and a link ending in #mextarget.
- What you can do after
- Apply it via WordPress and HTML to create a link that opens directly at a chosen page element.
Read how WordPress Power Toolkit: Harness AI to build next-level websites explains id attribute →
Related concepts
- attributekind of · An attribute is a named property, value, or piece of information associated with an entity, object, or program element.
- web formconfigures · A web form is a browser interface that groups controls for collecting structured user input and submitting it to an application or server.
- hypertext linkconfigures · A hypertext link is a reference embedded in digital content that enables navigation to another resource or location.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

