Can I Use Anchor Without Href? | Placeholder Hyperlink - Code

In HTML5, using an aanchor element without an href attribute is valid. It is considered to be a “placeholder hyperlink.” You can use class and other attributes, but you can not use target, download, rel, hreflang, and type.

Example:

<a>previous</a>

If you have to use href for backwards compability, you can also use (do-nothing link)

<a href="javascript:void(0)">link</a>

Read more: A href JavaScript void 0

Example anchor without href

HTML <a> tag example – html anchor no href:-

<html> <body> <a>previous</a> </body> </html>

Output:

use anchor without href

Do comment if you have any doubts and suggestions on this HTML topic.

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

OS: Windows 10

Code: HTML 5 Version

Share this:

  • Facebook
  • WhatsApp
  • LinkedIn
  • More
  • X
  • Print
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • Email

Related

Từ khóa » Html5 A Tag Without Href