Skip to main content

HTML Guide

Bad value “” for attribute “type” on element “a”: Expected a MIME type but saw the empty string.

Empty type attributes are invalid on the <a> element; you must either remove the type attribute or provide a valid MIME type value.

The type attribute on an <a> (anchor) element specifies the MIME type of the linked resource. According to the WHATWG HTML specification and W3C validator, the value of the type attribute cannot be an empty string. It should be a valid MIME type, such as application/pdf or text/html. If you do not know the MIME type or it’s not relevant, you should omit the attribute.

Incorrect HTML example (causes validation error):

<a href="document.pdf" type="">Download PDF</a>

Correct HTML example (remove the invalid attribute):

<a href="document.pdf">Download PDF</a>

Correct HTML example (provide a valid MIME type):

<a href="document.pdf" type="application/pdf">Download PDF</a>

If the type is unknown or unnecessary, leaving it out is preferred to using an empty value.

Learn more:

Related W3C validator issues