# Bad value “//X” for attribute “href” on element “a”: Invalid host: empty host.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-double-slash-x-for-attribute-href-on-element-a-invalid-host-empty-host
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

A URL that starts with `//` needs a host name right after the two slashes, and this `href` has none.

An `href` such as `//example.com/news` is a scheme-relative URL. The browser keeps the scheme of the current page (`http:` or `https:`) and reads everything after the `//`, up to the next `/`, `?` or `#`, as the host. In `//?page=news`, `//#contact` or a bare `//`, that part is empty. The URL Standard rejects a URL with no host, so the link has no valid destination.

The extra slash usually comes from a typo, or from a template that glued a base path ending in `/` onto a path starting with `/`. In that case the link was meant to be root-relative: `/?page=news` is the site's home page with a query string, and `/#contact` is an anchor on that page. Drop one slash and the error goes away. If the link goes to another site, put that site's host after the slashes, or write the full address, such as `https://example.com/?page=news`.

## Invalid example

```html
<nav>
  <a href="//?page=news">News</a>
  <a href="//#contact">Contact</a>
</nav>
```

## Valid example

```html
<nav>
  <a href="/?page=news">News</a>
  <a href="/#contact">Contact</a>
</nav>
```
