Skip to main content
HTML Validation

Attribute value missing.

About This HTML Issue

When you write an attribute with an equals sign, the HTML specification expects a value to follow — either quoted ("value") or unquoted. An attribute like style= or class= leaves the parser in an ambiguous state because the equals sign signals that a value is coming, but nothing is there. While browsers may attempt to recover from this error, their behavior is not guaranteed to be consistent, and the resulting interpretation may not match your intent.

This matters for several reasons. First, it produces invalid HTML that fails W3C validation, which can be a requirement for accessibility compliance and professional standards. Second, certain attributes like style, class, or id with missing values can cause unexpected behavior in CSS selectors or JavaScript DOM queries. Third, assistive technologies such as screen readers may misinterpret malformed attributes, potentially degrading the experience for users with disabilities.

There are a few ways to fix this issue depending on what you intended:

  • Provide a value: Add the missing value in quotes after the equals sign (e.g., class="container").
  • Use an empty string: If you intentionally want a blank value, explicitly use empty quotes (e.g., style="").
  • Remove the attribute: If the attribute isn’t needed, delete it entirely.
  • Remove the equals sign: If the attribute is a boolean attribute like disabled or hidden, it doesn’t need an equals sign or a value at all.

Examples

Missing attribute value (invalid)

<!-- The style attribute has an equals sign but no value -->

<p style=>This paragraph has an invalid attribute.</p>
<!-- The class attribute is missing its value -->

<div class=>Content here</div>
<!-- The id attribute has no value after the equals sign -->

<span id=>Some text</span>

Providing a proper value (valid)

<!-- Correct: the style attribute has a value -->

<p style="color: blue;">This paragraph is styled correctly.</p>
<!-- Correct: the class attribute has a value -->

<div class="wrapper">Content here</div>

Using an empty string explicitly (valid)

If you genuinely need the attribute present but with no meaningful value, use empty quotes. This is syntactically valid, though often unnecessary:

<p style="">This paragraph has an explicitly empty style.</p>

Boolean attributes without equals signs (valid)

Boolean attributes like disabled, hidden, and readonly don’t require a value. If you accidentally wrote one of these with a trailing equals sign, simply remove it:

<!-- Invalid: equals sign with no value -->

<button disabled=>Submit</button>

<!-- Valid: boolean attribute with no equals sign -->

<button disabled>Submit</button>

Common mistake with dynamic templates

This error frequently appears when a templating engine or framework outputs an attribute with a missing or null value. For example, server-rendered HTML might produce:

<!-- A template rendered an empty value -->

<a href=>Click here</a>

The fix is to ensure your template logic provides a valid value or omits the attribute entirely:

<a href="https://example.com">Click here</a>

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?

Ready to validate your sites?
Start your trial today.