Trainer Riad Thalji Website

HTML Tutorial

HTML Tutorial

by Trainer Riad Thalji


directions can help making the underlined page or section Left-to-Right or Right-to-left oriented.  It’s most common use is for right to left languages like Arabic.

Directions can be applied to the whole page or body, or to specific sections.

To apply right to left direction to the whole page you may write:

<html dir=”rtl”>
Or <body dir=”rtl”>

To apply it to a section like:

<div>, <h1> or <p>
,you may write:
<h1 dir=”rtl”>your text </h1>
<div dir=”rtl”>
<p dir=”rtl”>This paragraph is right to left </p>
<p dir=”ltr”>While this one is left to right </p>

Note that while the outer tag which is the <div> directs the text under it from right to left; the inner second paragraph from left to right.

As a rule, when ever an inner tag in an HTML code have a different formatting from its parent, the inner one always has the priority.

If your browser can read Arabic, here is an example using the right-to-left direction to and Arabic text:

<!doctype html>
<h1 dir=”rtl”>
<span dir="RTL">السلام عليكم </span>
<h2 dir=”ltr”>The above sentence is a greeting in Arabic </h2>

Join Our Coming PMP Prep Course

Delivered by Trainer

Riad Thalji