HTML - (Element text Directionality | dir attribute)

> (World Wide) Web - (W3|WWW) > HyperText markup Language (HTML)

1 - About

The dir global attribute specifies the element's text directionality.

Advertising

3 - Syntax

The attribute is an enumerated attribute with the following keywords:

  • The ltr keyword (left-to-right text) (default)
  • The rtl keyword (right-to-left text)
  • The auto keyword (The direction is determined programmatically using the contents of the element)

4 - Example

4.1 - ltr

The direction ltr is applied as an attribute of the blockquote HTML element

<blockquote dir=ltr>
<p>I didn't like the play, but then I saw
it under adverse conditions - the curtain was up.</p>
<cite>- Groucho Marx</cite>
</blockquote>

4.2 - rtl

The direction rtl is applied using Css.

<blockquote>
<p>I didn't like the play, but then I saw
it under adverse conditions - the curtain was up.</p>
<cite>- Groucho Marx</cite>
</blockquote>
blockquote {
  direction: rtl;
}

Advertising

5 - Documentation / Reference

web/html/dir.txt ยท Last modified: 2019/02/09 11:29 by gerardnico