# Bad value “” for attribute “dir” on element “div”.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-for-attribute-dir-on-element-div
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `dir` attribute on the `<div>` is set to an empty string. `dir` is an enumerated attribute that only accepts `ltr`, `rtl`, or `auto`, so an empty value is invalid.

The attribute sets the base text direction of an element's content: `ltr` for left-to-right scripts such as English, `rtl` for right-to-left scripts such as Arabic or Hebrew, and `auto` to let the browser decide from the first strongly typed character. An empty `dir=""` names none of these, so the browser has nothing to apply.

This normally comes from a template that prints `dir=""` when the variable feeding it is blank. If the element does not need an explicit direction, remove the attribute and it will inherit the direction of its parent. Otherwise, set one of the three valid values.

## Invalid example

```html
<div dir="">Welcome</div>
```

## Valid example

Remove the attribute to inherit the direction from the parent:

```html
<div>Welcome</div>
```

Or set a valid value. Use `auto` when the text comes from users and its direction is not known in advance:

```html
<div dir="auto">مرحبا</div>
```
