CSharpBeginner CSharpBeginner - 6 months ago 41
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?



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">