liveBook · Manning

Id attribute

As explained in 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.

An id attribute gives an HTML element a name so a hyperlink can target that exact spot instead of only opening the top of a page. Add it inside an element’s opening tag, such as a paragraph tag. section 3.5.2

Link to a paragraph

Mark the destination with <p id="mextarget">, then add #mextarget to the page permalink in the link address. Selecting that link opens the page directly at the marked paragraph. section 3.5.2

To create an in-page destination:

  • Place an id attribute at the start of the target element and choose its name. section 3.5.2
  • Save the page, copy its permalink, and append # followed by the id name to the link URL. section 3.5.2
  • Test the link on the site to confirm it jumps to the intended paragraph or heading. section 3.5.2
Figure 3.7 A target ID is placed at the start of a target paragraph.

See the target ID positioned in a paragraph’s opening tag. section 3.5.2

How WordPress Power Toolkit: Harness AI to build next-level websites covers it

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 it assumes
Teaches the target-marking steps while assuming access to page HTML editing and a page permalink.
What you can do after
Apply it via WordPress and HTML to create a link that opens directly at a chosen page element.
How it connects
Connects HTML, hyperlinks, permalinks, and validation through links to named page locations.

Also explained in

Compare how 2 books explain id attribute →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of WordPress Power Toolkit: Harness AI to build next-level websites. The section links point to the parts of the book it draws on.