Skip to main content
HTML Validation

Bad value “” for attribute “dir” on element “span”.

About This HTML Issue

The dir attribute cannot be an empty string — it must be one of the allowed values: ltr, rtl, or auto.

The dir attribute specifies the text directionality of an element’s content. It is a global attribute, meaning it can be used on any HTML element. When you set dir="", the validator rejects it because an empty string doesn’t convey any meaningful direction.

If you don’t need to specify a direction, simply remove the dir attribute entirely. The element will naturally inherit the directionality from its parent. If you want the browser to determine the direction based on the text content, use dir="auto".

Invalid Example

<span dir="">Some text</span>

Valid Examples

<!-- Remove the attribute to inherit direction from the parent -->

<span>Some text</span>

<!-- Or explicitly set a valid direction -->

<span dir="ltr">Some text</span>

<!-- Or let the browser decide based on content -->

<span dir="auto">Some text</span>

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