Skip to main content

HTML Guide

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

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://).

Related W3C validator issues