You need to manually put dir attribute for for each div:
<div lang="ar" dir="rtl"><!-- some content here --></div>
<div lang="en" dir="ltr"><!-- some content here --></div>
This would automatically change flow. However, you might need to adjust certain elements depending on the language. You can do that by CSS lang pseudo-attribute:
p:lang(ar) { text-align: right; }
p:lang(en) { text-align: left; }
Of course you could possibly do that:
div:lang(en) { direction: ltr; }
div:lang(ar) { direction: rtl; }
This is unrecommended method. Since you need to put language somehow, you could also put dir attribute. If you do that from some programming language, directionality could usually be determined for given spoken language (Locale, Culture, whatever). But that would be another question.