Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?
Thanks.

like image 355
CSharpBeginner Avatar asked Jul 13 '16 08:07

CSharpBeginner


1 Answers

Using CSS:

* {
    direction: rtl;
}

Using JavaScript:

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

OR

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

OR ( from evolutionxbox comment )

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

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

$("html").children().css("direction","rtl");

Inline Coding:

<body dir="rtl">

OR

<html dir="rtl">
like image 114
NETCreator Hosting - WebDesign Avatar answered Sep 29 '22 09:09

NETCreator Hosting - WebDesign