Reputation: 1564
I have a block of content contains both left-to-right and right-to-left text and I want to display both correctly.
I wanna do that with only CSS .
I think we should have something like this , But direction Auto
is not exist
.content {
direction : auto // rtl for rtl text and vice versa
text-align : auto
}
Upvotes: 0
Views: 241
Reputation: 2639
You can use dir="auto"
in HTML, from MDN :
<p dir="rtl">This paragraph is in English but incorrectly goes right to left.</p>
<p dir="ltr">This paragraph is in English and correctly goes left to right.</p>
<p dir="auto">This paragraph is in English and correctly goes left to right.</p>
<hr>
<p>هذه الفقرة باللغة العربية ولكن بشكل خاطئ من اليسار إلى اليمين.</p>
<p dir="auto">هذه الفقرة باللغة العربية ، لذا يجب الانتقال من اليمين إلى اليسار.</p>
Upvotes: 2