HTML dir egenskab

Definition og brug

dir Egenskab definerer tekstdirectionen for elementets indhold.

See also:

HTML tutorial:HTML attributes

CSS reference manual:CSS direction attribute

HTML DOM reference manual:HTML DOM dir attribute

HTML DOM reference manual:Style direction attribute

Example

A paragraph with a text direction from right to left:

<p dir="rtl">Write this text right-to-left!</p>

Try it yourself

Syntax

<element dir="ltr|rtl|auto">

Attribute value

Value Description
ltr Default. Text direction from left to right.
rtl Text direction from right to left.
auto Let the browser determine the text direction based on the content (recommended only when the text direction is unknown).

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support