Skip to content

Link placeholder in HTML 5 | A element has no href attribute

  • by

In HTML5 the anchor tag has no longer requires any attributes, even the href attribute is optional and without attributes, it’s called a placeholder link.

Example

<a>Placeholder Link</a>

Note: Until HTML5 was released, the tag has required one attribute: href.

Link placeholder without href attribute Example

HTML example code:

If the <a> element has no href attribute, then its represents a placeholder.

<html>
<body>
	<a>Placeholder Link</a>
</body>
</html>

Output:

Link placeholder in HTML 5

Replacements of span element

A span element replacement used to style links targeting the current page. Use removed the href attribute from the link (anchor tag).

<ul>
    <li><a href="/">Home</a></li>
    <li><a href="/news">News</a></li>
    <li><a>Examples</a></li>
    <li><a href="/legal">Legal</a></li>
</ul>

Note: Using # in href has a problem because a placeholder link is that the link is clickable, and this can cause confusion for users.

<a href="#">Example Link</a>

Do comment if you have any doubts and suggestion on this HTML href code.

Note: The All HTML Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading