Common Mistakes

The <a> element is a container element. This means you need an opening and closing <a> tag, as in the following example:

<a href="dest.html">See the destination</a>

Which can be split into sections as follows:

<a href="dest.html"> See the destination </a>
This tag starts “active text” for a link with dest.html as the hypertext reference. This is the active text And this closing tag marks the end of the clickable link

Mistake 1: The “All-In-One” Error

The most common mistake is to forget that <a> is a container; people try to put everything into one tag:

<a href="dest.html" See the destination>

Mistake 2: Misplaced Closing Tag

In the bad HTML tag below, the author remembered to use both an opening and closing tag, but didn’t put the link’s text between them. Since there’s nothing between the two tags, there won’t be any clickable text showing up on the screen.

<a href="dest.html"></a>See the destination

You don’t need any text between the opening and closing tags when you’re defining an anchor with the id= attribute, since it’s just a marker. This is another source of confusion for beginning authors.

Mistake 3: Pound Sign Paranoia

When using a within-page link, people either leave out the # in the href= or add an extra one in the id= attribute.

Too Few # Too Many #
<a href="anchor">Jump</a>
<a id="anchor"></a>
(The first line should have a #)
<a href="#anchor">Jump</a>
<a id="#anchor"></a>
(The last line should not have a #)