HTML Attributes

HTML dirname attribute

Build a form with the HTML form generator

Adds a separate form data entry recording the directionality of a supported text input or textarea. The submitted direction is ltr or rtl. Applicable elements include: <input>, <textarea>. Check each element’s value rules. The attribute value is the name of the extra submitted entry, not a direction. For example dirname="comment.dir" can submit comment.dir=rtl alongside the comment field. Only supported control types contribute the direction entry.

Formal Syntax & Structure

html syntaxhtml
dirname="comment.dir"

Parameters & Attributes

NameTypeDescription
dirnameform field nameAdds a separate form data entry recording the directionality of a supported text input or textarea. The submitted direction is ltr or rtl.

Working Example

Example Snippethtml
<label>Comment <textarea name="comment" dirname="comment.dir" dir="auto"></textarea></label>

Browser Compatibility

Minimum supported versions across modern rendering engines

Blink (modern)
Chrome
17
Yes
Gecko
Firefox
116
Yes
WebKit
Safari
6
Yes
Presto / Blink
Opera
≤12.1
Yes
Desktop support for dirname on input only; other elements, input types, individual values and mobile behavior may differ.
HTML Living Standard
HTML Reference