Most stylesheets are written as if every reader reads left to right. Then a Persian or Arabic version is needed, and someone writes a second stylesheet full of [dir="rtl"] overrides that flip margins, paddings and floats. It works until the next feature ships and nobody remembers to add its override.
There is a simpler way. CSS has had logical properties for years, and every current browser supports them.
Physical vs logical
A physical property names a side of the screen: margin-left , padding-right , border-left . A logical property names a side of the text flow:
margin-inline-start is the side where a line starts. Left in English, right in Persian.
margin-inline-end is where a line ends.
margin-block-start and margin-block-end are the top and bottom in horizontal writing.
Set dir="rtl" on the html element and every logical property flips by itself.…