Using Persian, Arabic, and Other Right-To-Left Languages in Web Pages

About this project

Project details

In designing right to left languages websites and mobile applications, we are one of the best and most experienced companies in Europe and we also provide different types of services to clients to design and develop web pages in Farsi (Persian), Kurdish and Arabic language.
Putting the text itself into a page isn’t the real issue, making it run in the correct direction might be the issue. Normally, texts run from the left part of the screen to the right part of the screen as it is rightly done in indo-European languages. Nonetheless, Arabic, Persian, Urdu and a lot of other languages are written in the opposite direction (from the right to the left.)

Step One: Set The Text Direction

The direction of text in a web page is based on the dir attribute in thetag. By default, the dir is set to left to right “ltr”, and this does not need to be declared explicitly. In order to set the opposite direction, you can set the dir to right to left “rtl”:

<html dir=”rtl”>

At one fell swoop, you should declare the language used on the page (assuming that primarily, the body text uses one language). Here, I will use Persian for the example:

<html lang=”he” dir=”rtl” xml:lang=”he” xmlns=”http://www.w3.org/1999/xhtml”>

As long as you utilize UTF-8 encoding on your pages, as we said in setting your HTML document up, all other things should naturally follow. I would suggest that you work along with general recommendations for making up body copies: putting down a text in the word processor in the correct manner and then copying it and pasting the copied text into a suitable mark up in your document.

<p><span dir=”rtl” lang=”he”></span></p>


Step Two: Deal With Exceptions

For instance, if most of the content of the document is in Hebrew and you would like to right a paragraph or a portion in English you would have to deal with that paragraph or portion like it’s an exception:

<p lang=”en” dir=”ltr”>I have moment</p>

I have moment

If it was just one sentence, a short phrase or probably an English quote you wanted to effect, you would have to make use of around the text, with values that are same with lang and dir, use as it is used in the above paragraph.

Step 3: Form The Title

One problem we constantly have is that the text in thetag will not correspond with directionality which means it remains left-to-right regardless of what has been stated. It is relatively impossible to use the dir attributes on the title; so, in place of that, we utilize HTML entities in place of Unicode control lettering:


Do you like this project?

Let's talk about yours!

Get in touch

Contact us:

[email protected]

Opening Hours

Monday - Friday
10:00 - 19:00 CET

Made with and passion by Cubex™