Skip to main content
HTML Validation

Attribute “href” without an explicit value seen. The attribute may be dropped by IE7.

About This HTML Issue

Empty href attributes like href or href="" are invalid in HTML and can cause unpredictable behavior.

According to the HTML specification, the href attribute in elements such as the a and link tags must contain a valid URL or fragment reference. An empty or omitted href results in the attribute being ignored or possibly causing compatibility problems, especially in older browsers. If you intend the link to do nothing, use href="#" and prevent the default action with JavaScript, or avoid making it a link if no action is necessary.

Valid HTML for a regular link:

<a href="https://example.com">Visit Example</a>

Valid usage for a link that does nothing:

<a href="#" onclick="return false;">Do nothing</a>

If the element should not be clickable, use a different tag such as span or button:

<span>Not a link</span>

or

<button type="button">Not a link</button>

Avoid writing:

<a href>Invalid link</a>

or

<a href="">Invalid link</a>

as these will produce the validation warning you saw.

Last reviewed: April 22, 2025

Was this guide helpful?

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Ready to validate your sites?
Start your free trial today.