HTML Checking for Large Sites
Rocket Validator automatically checks your pages on the W3C Validator.
Bad value “X” for attribute “href” on element “a”: Illegal character in query: space is not allowed.
The href
attribute on an <a>
tag contains an space, which is not allowed. Consider replacing space characters with “%20”.
Related W3C validator issues
A button
element, or an element with the role=button
attribute, is not allowed to be nested inside an <a>
element.
An <a>
element cannot contain a descendant element with the attribute tabindex
.
Learn more:
An <a>
element has been found with an invalid href
attribute, containing more than one #
adjacent character.
The #
is used to separate the fragment part of an URI (typically used to indicate a section within a document). For example, this is a valid link to a URI containing a fragment:
<a href="https://example.com/faqs#pricing">pricing</a>
The next example is invalid because it contains two adjacent #
characters, so that the fragment part would be #pricing
instead of pricing
:
<a href="https://example.com/faqs##pricing">pricing</a>
Learn more:
The href
attribute of an <a>
element contains an invalid character, that should be properly encoded as a URI percent-encoded character.
Learn more:
The href
attribute on the link
element must not be empty.
The src
attribute on an <img>
element contains an invalid character, that should be properly encoded as a URI percent-encoded character.
Learn more:
The target
attribute on <a>
elements can’t be blank.
This attribute defines the browsing context for links, that is, where should the linked documents be opened. This was used extensively on the now deprecated <frame>
element, so you could give the name of the frame to open the document in, but is now more used to force links to open in a separate tab or window using target="_blank"
. Another option is using a name, so the new browsing context can be referred to on subsequent clicks on links with the same target
.
For example, this will force the links to open on a new tab:
<a href="https://example.com" target="_blank">will open a blank tab</a>
Learn more:
The href
attribute on an a
tag expects a valid URL, but only http://
was found.
<a>
tags can be used to link to an email address using the mailto
protocol in the href
attribute. Ensure that there is no space in the email address.
<a href="mailto: liza@example.com">This is wrong as it contains an space</a>
<a href="mailto:liza@example.com">This is OK</a>
The href
attribute on an <a>
link contains a space character, which is not allowed. If you’re trying to link to a phone URL, review the href
attribute to remove unallowed characters, as in this example:
<!-- Invalid as it contains a space character -->
<a href="tel: +123456789">call me</a>
<!-- Valid -->
<a href="tel:+123456789">call me</a>
Source:
The accept
attribute may be specified to provide browsers with a hint of what file types will be accepted on an <input>
element. It expects a comma-separated list of allowed file types. Refer to the list of media types to check the accepted tokens. In this example, the first line is invalid while the second is valid:
<input name='file' type='file' accept='doc, docx, pdf' />
<input name='file' type='file' accept='text/doc, text/docx, application/pdf' />
Space characters are not allowed in href
attributes. Instead, they should be converted to %20
. In this example, the first line is invalid and the second is valid:
<a href="https://example.com#some term">invalid</a>
<a href="https://example.com#some%20term">valid</a>
The href
attribute on an element <a>
contains a character that is not allowed, and should be encoded.
Some typical examples include the pipe character |
that should be replaced by its encoded alternative %7C
, and the left square bracket [
that needs to be encoded as %5B
.
The at symbol (@
) should be percent-encoded as %40
in order to include it at an href
attribute.
The href
attribute on an element <link>
contains a character that is not allowed, and should be encoded.
Some typical examples include the pipe character |
that should be replaced by its encoded alternative %7C
, and the left square bracket [
that needs to be encoded as %5B
.
Space characters are not allowed in src
attributes. Instead, they should be converted to %20
. In this example, the first line is invalid and the second is valid:
<img src="https://example.com/?s=some term" alt="description" />
<img src="https://example.com/?s=some%20term" alt="description" />
The src
attribute on an <img>
tag is not allowed to contain space characters. You should replace them with “%20
“.
The value used in the target
property of an <a>
element has been identified as a keyword because it starts with an underscore _
, but it’s not a valid keyword.
Values starting with an underscore for the target
property are used for reserved keywords like _blank
, _self
, _parent
or _top
.
Learn more:
The value provided on the type
attribute of an a
element is not a valid MIME type.
The type
attribute expects a MIME type that hints at the linked URL’s format.
Read more:
The type
attribute on <a>
elements, when present, gives a hint on the MIME type of the linked resource, for example:
<a href="application/pdf" src="book.pdf">Read our book</a>
<a href="image/jpeg" src="photo.jpeg">See a photo</a>
That is, we’re talking about the type of the linked resource, not the type of the <a>
element, as it’s sometimes misunderstood. The following example is invalid because button
is not a valid MIME type.
<a href="/order.php" type="button">Submit</a>
Learn more:
The <a>
element requires either a href
attribute, or a role
attribute.
Learn more:
An HTML tag could not be parsed, most probably because of a typo.
An </a>
end tag has been found to violate nesting rules. <a>
tags can’t include other <a>
tags inside. Most probable cause is an unclosed <a>
tag, like in this example:
<a href="one.html">Page 1
<a href="two.html">Page 2</a>
A character has been found in the document that is not allowed in the charset encoding being used.
The document has been declared to use a windows-1251
charset but the actual contents seems to be utf-8
. You should update the charset to that like in this example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
The document could not be properly parsed due to malformed characters. Check the document encoding.
An <a>
tag can’t include other <a>
tags inside. Most probable cause is an unclosed <a>
tag, like in this example:
<a href="one.html">Page 1
<a href="two.html">Page 2</a>
An <a>
element has been found in an invalid place within a <table>
element.
For example, the following code would cause this issue:
<table>
<tr>
<a href="#">link</a>
</tr>
</table>
Instead, the <a>
element should be inside a <td>
element, as a <tr>
can’t hold content directly:
<table>
<tr>
<td>
<a href="#">link</a>
</td>
</tr>
</table>
Read about Normalization in HTML and CSS.
A button
element, or an element with the role=button
attribute, is not allowed to be nested inside an <a>
element.
A <label>
tag can’t be used inside an <a>
tag. Consider using other tags like <span>
.
Links created with the <a>
element no longer accept a shape
attribute. In order to define image maps, use the <area>
element instead.
Learn more:
When was the last time you validated your whole site?
Keep your sites healthy checking for A11Y/HTML issues on an automated schedule.