HTML attr dir

From Htmlpedia
Jump to: navigation, search

HTML attribute dir

This attribute specifies the base direction of directionally neutral text (i.e., text that doesn't have inherent directionality as defined in UNICODE) in an element's content and attribute values. It also specifies the directionality of tables. Possible values:

  • LTR: Left-to-right text or table.
  • RTL: Right-to-left text or table.


In this example, the text for the whole page is display left to right except for the div with the ID "righttoleft" which will be right to left.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" dir="ltr">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
left to right
<div id="righttoleft" dir="rtl">
right to left