CSS properties - direction

revision:


direction property

- specifies the text direction/writing direction within a block-level element.

Tip: use this property together with the unicode-bidi property to set or return whether the text should be overridden to support multiple languages in the same document.

CSS syntax : direction: ltr | rtl | initial | inherit;

Property values:

ltr : text direction goes from left-to-right. This is default

rtl : text direction goes from right-to-left

initial : sets this property to its default value.

inherit : inherits this property from its parent element.

JavaScript syntax: object.style.direction="rtl"

example: direction property

This text goes from left to right. This is default.

This text goes from right to left.

code:
                    <div>
                        <p>This text goes from left to right. This is default.</p>
                        <p class="rtl">This text goes from right to left.</p>
                    </div>
                    <style>
                        p.rtl {direction: rtl;}
                    </style>