Interactive online courses HTML Academy
2026-03-09 10:57 Diff

Another interesting but underutilized feature for working with text in CSS is text direction control. Usually this feature is used to correctly display Arabic and Hebrew, which are languages that are read from right to left. In CSS, the direction of the text is controlled using the direction property, which takes the values of ltr (left to right direction) andrtl (right to left direction).

However, in addition to the text direction, the direction property also affects the position of the scroll bar in the block.

If you try to reverse the direction of the text written in the Cyrillic or Latin alphabet to read from right to left (direction: rtl;), then you will see that the text in the block will align to the other side. The scrollbar of the block will also change its position to the opposite side as well. However, the text itself will not change direction. This is because the browser automatically sets the correct direction for the text by analyzing the Unicode characters that have been used. If you would like to influence the browser’s decision, you can use the unicode-bidi property, which takes the following values:

  • normal – The browser independently determines how it should display text based on the used Unicode characters.
  • embed - Overrides the direction of the text by positioning it in accordance with the direction property (which is used when the text in the block is in two bi-directional languages);
  • bidi-override - Overrides the order of characters in the text in accordance with the direction value.