In this post you’ll learn how to make web pages in Urdu, how to type in Urdu, how to use custom Urdu fonts on your website and how to configure and style a website in Urdu.
Finding a font
If you are having difficulty finding good Urdu fonts (type faces), try Persian. Persian is written very similar to Urdu (both are written in Nastaleeq script) and will do nicely for our use.
After Persian, Arabic comes at a close second in similarity. While it’s easier to find arabic fonts, using it for Urdu has caveats: some alphabets (like chay and gaaf) will be missing.
Make sure you have the right to use the font.
Urdu is a Right To Left (rtl) language. You start writing from the right side and move to the left. When using an RTL language on your website, you can specify it in the HTML code using the
The dir attribute tells the browser the direction in which the displayed text is intended to be read. The browser will render text from left to right by default, but as with the lang attribute, you’ll need to override the intended reading direction if you’re including text that runs in the opposite direction (for example, Arabic or Hebrew).
dir tag is deprecated, it is not supported in HTML5. Use CSS instead.
Since our website is going to be bilingual, i.e. it will have both English and Urdu posts, we will add a CSS class
.urdu to the content whenever the content is going to be in Urdu. Our custom font and any specific styling will also be mentioned in the
.urdu CSS class and applied when needed.
The direction can also be mentioned in the CSS.
Using custom fonts
Once we have found a font, we will use the Webfont Generator to convert our fonts in formats for use on website and get the @font-face kit.
we are going to generate our magical fonts for use on the web with support for all browsers.
Font faces are defined in the css stylesheet. So we’ll take the code from the @font-face kit and add it to our stylesheet.