RTL (오른쪽에서 왼쪽)
문자가 오른쪽에서 왼쪽으로 흐르는 텍스트 방향. 아랍어, 히브리어, 타아나 문자 등에서 사용되며, 올바른 표시를 위해 양방향 알고리즘이 필요합니다.
What is RTL (Right-to-Left)?
RTL stands for Right-to-Left, describing text that is written and read from right to left. Arabic, Hebrew, Persian (Farsi), Urdu, and several other scripts are inherently RTL. This is not a stylistic choice — it is the fundamental direction of these writing systems, as fixed by their orthographic traditions dating back thousands of years. Proper RTL support requires changes at every layer of text technology: from Unicode's bidirectional algorithm to CSS properties to HTML markup.
Unicode Bidirectional Algorithm (Bidi)
The Unicode Bidirectional Algorithm (UAX #9) is the specification for how to display text that mixes LTR and RTL content — called bidirectional or bidi text. Because a single paragraph might contain English, Arabic, and numbers all together, a strict mechanical rule set is needed to determine the display order of each run.
The algorithm assigns every character a bidi category: - L (Left-to-Right): A–Z, Latin digits, most punctuation - R (Right-to-Left): Hebrew characters - AL (Arabic Letter): Arabic, Thaana, Syriac characters - AN (Arabic Number): Arabic-Indic digits - EN (European Number): 0–9 ASCII digits
The algorithm then resolves the visual ordering based on the paragraph's base direction and these per-character categories.
Bidi Control Characters
Unicode provides invisible characters to explicitly override the automatic bidi behavior:
| Character | Unicode | Name | Effect |
|---|---|---|---|
| RLM | U+200F | Right-to-Left Mark | Forces bidi context rightward |
| LRM | U+200E | Left-to-Right Mark | Forces bidi context leftward |
| RLE | U+202B | Right-to-Left Embedding | Start RTL embedding |
| LRE | U+202A | Left-to-Right Embedding | Start LTR embedding |
| RLO | U+202E | Right-to-Left Override | Force all text RTL |
| LRO | U+202D | Left-to-Right Override | Force all text LTR |
| U+202C | Pop Directional Formatting | End an embedding/override | |
| RLI | U+2067 | Right-to-Left Isolate | RTL bidi isolate (modern) |
| LRI | U+2066 | Left-to-Right Isolate | LTR bidi isolate (modern) |
| PDI | U+2069 | Pop Directional Isolate | End isolate |
The RLO character (U+202E) was notoriously abused in filenames to disguise file extensions: Vacationgpj.exe would display as Vacationgpj.exe visually.
RTL in HTML and CSS
<!-- Set paragraph direction -->
<p dir="rtl">مرحبا بالعالم</p>
<!-- HTML attribute on document root -->
<html lang="ar" dir="rtl">
<!-- Use the <bdi> element for user-generated content of unknown direction -->
<p>Posted by <bdi>محمد</bdi> yesterday</p>
/* CSS direction property */
.arabic-text {
direction: rtl;
text-align: right; /* or use text-align: start (logical) */
}
/* CSS logical properties (preferred for bidi) */
.box {
margin-inline-start: 1em; /* left in LTR, right in RTL */
padding-inline-end: 0.5em; /* right in LTR, left in RTL */
border-inline-start: 2px solid; /* left border in LTR */
}
Mirroring in RTL
When a UI is mirrored for RTL, directional icons must also be mirrored: a "forward" arrow in LTR points right (→), but in RTL it should point left (←). Layout elements like sidebars, toolbars, and scrollbars typically mirror position.
Quick Facts
| Property | Value |
|---|---|
| RTL scripts | Arabic, Hebrew, Persian, Urdu, Thaana, Syriac, N'Ko, Tifinagh |
| Unicode bidi spec | UAX #9 (Unicode Standard Annex 9) |
| HTML direction attribute | dir="rtl" or dir="ltr" |
| CSS property | direction: rtl |
| Right-to-Left Mark | U+200F (RLM) |
| Right-to-Left Override | U+202E (RLO) — security risk |
| Modern isolate characters | RLI (U+2067), LRI (U+2066), PDI (U+2069) |
| CSS logical properties | margin-inline-start, padding-inline-end for bidi-aware layout |
관련 용어
타이포그래피의 더 많은 용어
CSS @font-face descriptor specifying which Unicode code points a font should cover. …
Em: 폰트 크기와 같은 너비. En: Em의 절반. 엠 대시 너비, 엠 …
The mechanism by which a rendering engine substitutes glyphs from a secondary …
Modern font format developed by Microsoft and Adobe supporting up to 65,535 …
Fonts downloaded by the browser to render text, declared via CSS @font-face. …
앞의 기본 문자에 붙어 수정하는 문자. 일반 범주: Mn(비공백), Mc(공백 결합), Me(둘러싸기). …
가로 또는 세로 공간을 표현하지만 눈에 보이는 글리프가 없는 문자. 유니코드는 서로 …
폰트가 렌더링하는 문자의 시각적 표현. 하나의 문자가 여러 글리프를 가질 수 있고(합자, …
전진 너비가 0인 문자 — 렌더링에서 보이지 않지만 텍스트 동작에 영향을 줍니다. …
문장의 일부를 구분하거나 범위를 나타내는 데 사용되는 구두점. 유니코드는 하이픈(‐), 엔 대시(–), …