dir attribute

dir=ltr/rtl/auto

Explanation

Dir attribute is used to align/place the text either in "Left/Right" direction of a page.
<ele dir="ltr/rtl/auto">
Values added with this attribute are:
ValueDescription
ltrText placed from left to right direction.
rtlThe text placed from right to left direction.
autoBrowser randomly places the text either left or right on the basis of total number of words in the content.

Example Code 1:

Result :

This is a content

Example Code 2:

Result :

This is a content

Example Code 3:

Result :

This is a content

    Example Code 1 (Explanation):
  • The content is placed from left to right direction.

  • Example Code 2 (Explanation):
  • The content is placed from right to left direction.

  • Example Code 3 (Explanation):
  • By default, the content will be placed in left side when "Auto" value is used.

Limitations:

It is applicable to all the browsers.

Ask Questions

Ask Question