Skip to main content
HTML Validation

“X” in an unquoted attribute value. Probable causes: Attributes running together or a URL query string in an unquoted attribute value.

About This HTML Issue

When you write an attribute value without quotes, the HTML parser follows strict rules about which characters are permitted. According to the WHATWG HTML specification, unquoted attribute values cannot contain spaces, ", ', =, <, >, or the backtick character. If any of these characters appear, the parser may misinterpret where the attribute value ends, potentially merging multiple attributes, breaking your markup, or producing unexpected rendering. URL query strings are an especially common trigger because they naturally contain &, =, and ? characters.

This is a problem for several reasons:

  • Parsing errors: Browsers use error recovery when encountering malformed attributes, but different browsers may recover differently, leading to inconsistent behavior.
  • Broken functionality: A URL like page.html?id=5&sort=name in an unquoted href will be parsed incorrectly — the browser may interpret sort=name as a separate HTML attribute rather than part of the URL.
  • Attributes running together: If you forget a closing quote on one attribute, the parser may consume the next attribute’s name and value as part of the first attribute’s value, silently breaking your element.
  • Standards compliance: Quoting all attribute values is a best practice recommended by the HTML specification for clarity and reliability.

The simplest and most robust fix is to always quote your attribute values using double quotes ("...") or single quotes ('...'). This eliminates ambiguity regardless of what characters the value contains.

Examples

Unquoted URL query string

A URL with query parameters in an unquoted href triggers this error because & and = confuse the parser:

<!-- ❌ Invalid: unquoted attribute value with query string -->

<a href=https://example.com/search?q=html&lang=en>Search</a>

The parser may interpret lang=en as a separate HTML attribute on the <a> element rather than part of the URL.

<!-- ✅ Valid: attribute value properly quoted -->

<a href="https://example.com/search?q=html&amp;lang=en">Search</a>

Attributes running together

A missing closing quote causes the next attribute to be absorbed into the first:

<!-- ❌ Invalid: missing closing quote on class causes attributes to merge -->

<div class="important id="main">Content</div>

The parser sees important id= as part of the class value, and "main" may be interpreted unpredictably.

<!-- ✅ Valid: both attributes properly quoted -->

<div class="important" id="main">Content</div>

Unquoted values with special characters

Even simple values can cause issues if they contain characters not allowed in unquoted attributes:

<!-- ❌ Invalid: unquoted value with characters that confuse the parser -->

<input type=text value=hello world>
<div class=important"></div>

In the first example, world is parsed as a separate attribute, not part of the value. In the second, the stray " after important triggers the error.

<!-- ✅ Valid: all attribute values are quoted -->

<input type="text" value="hello world">
<div class="important"></div>

Simple unquoted values (technically valid but discouraged)

While simple unquoted values without special characters are technically allowed by the spec, quoting them is strongly recommended for consistency and to avoid mistakes:

<!-- Technically valid but discouraged -->

<div class=important></div>

<!-- ✅ Recommended: always use quotes -->

<div class="important"></div>

Adopting the habit of always quoting attribute values prevents this entire class of validation errors and makes your HTML easier to read and maintain.

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
$7 / 7 days

Pro Trial

Full Pro access. Cancel anytime.

Start Pro Trial →

Join teams across 40+ countries