Global Attributes

dir="auto"

Infers base direction from the text, typically its first strong directional character. Useful for user-generated content whose language is unknown; it is not a language detector. Global enumerated attribute; absent or invalid values normally inherit direction (bdi has a special auto default). Use lang separately.

Formal Syntax & Structure

html syntaxhtml
dir="auto"

Parameters & Attributes

NameTypeDescription
dirkeywordInfers base direction from the text, typically its first strong directional character. Useful for user-generated content whose language is unknown; it is not a language detector.

Working Example

Example Snippethtml
<p dir="auto">سلام دنیا — Hello</p>
HTML Reference