In HTML, named locations in the document (also known as
fragment identifiers) were
defined by the “name”
attribute. In XHTML, this is replaced by the id attribute. Any element can carry an id attribute.
Suppose you want to define a fragment identifier on a
page so that the browser will jump to there if the URL
ends in “#planks”:
| HTML | XHTML |
|---|---|
<h2><a name="planks">Planks</a></h2> | <h2 id="planks">Planks</h2> |