CSharpBeginner CSharpBeginner - 1 year ago 101
CSS Question

Direction rtl to all page

I have a long html page.

I want to change the direction of all text/tables to rtl.

How can i do that to all page instead of to change to any element the direction to rtl?


Answer Source

Using CSS:

* {
    direction: rtl;

Using JavaScript:

var children = document.children;
var i;
for (i = 0; i < children.length; i++) {
   children[i].style.direction = "rtl";


document.body.style.direction = "rtl";

OR ( from evolutionxbox comment )

document.body.setAttribute('dir', 'rtl')

Using JQuery (even if you are not asking about):


Inline Coding:

<body dir="rtl">


<html dir="rtl">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download