Skip to main content
HTML Validation

Bad value X for attribute “href” on element “a”: Expected a slash ("/").

About This HTML Issue

The W3C HTML Validator issue you encountered indicates that the URL provided in the href attribute of an anchor (<a>) element is not formatted correctly.

How to Fix the Issue

  • Check the Protocol: For a valid URL, make sure that after https: there are two slashes (//).
  • Update the URL: Correct the URL format to include the missing slash.

Example of Incorrect HTML

Here is an example of the code that would trigger the validation error:

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

Corrected HTML

Here’s how the corrected code should look:

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

Summary

Make sure that all URLs within href attributes are correctly formatted with both slashes following the protocol (https:// or http://).

Last reviewed: August 02, 2024

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.