Unquoted attribute value validator

“Can I use <a href=foo></a> and a[href=foo] {} or does it need quotes?”

In HTML, that’s an invalid unquoted attribute value:

<a href=mailto:foo@example.org?subject=bar></a>

In CSS, that’s an invalid unquoted attribute value:

<style>
a[href=mailto:foo@example.org?subject=bar] {
background: hotpink;
}
</style>

To quote “Unquoted attribute values in HTML and CSS”:

A valid unquoted attribute value in HTML is any string of text that is not the empty string and that doesn’t contain spaces, tabs, line feeds, form feeds, carriage returns, ", ', `, =, <, or >.

A valid unquoted attribute value in CSS is any string of text that is not the empty string, consists of escaped characters and/or characters matching /[-_\u00A0-\u10FFFF]/ entirely, and doesn’t start with a digit or two hyphens or a hyphen followed by a digit.