1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
---
title: direction
slug: Web/CSS/direction
translation_of: Web/CSS/direction
---
<div>{{CSSRef}}</div>
<p><span class="seoSummary">The <strong><code>direction</code></strong> CSS property sets the direction of text, table columns, and horizontal overflow.</span> Use <code>rtl</code> for languages written from right to left (like Hebrew or Arabic), and <code>ltr</code> for those written from left to right (like English and most other languages).</p>
<div>{{EmbedInteractiveExample("pages/css/direction.html")}}</div>
<p>Заметьте, что направление текста обычно задано в документе (т.е. с помощью <a href="/en-US/docs/Web/HTML/Global_attributes/dir">HTML's <code>dir</code> attribute</a>), а не посредством прямого использования свойства <code>direction</code>.</p>
<p>The property sets the base text direction of block-level elements and the direction of embeddings created by the {{Cssxref("unicode-bidi")}} property. It also sets the default alignment of text, block-level elements, and the direction that cells flow within a table row.</p>
<p>Unlike the <code>dir</code> attribute in HTML, the <code>direction</code> property is not inherited from table columns into table cells, since CSS inheritance follows the document tree, and table cells are inside of rows but not inside of columns.</p>
<p>The <code>direction</code> and {{cssxref("unicode-bidi")}} properties are the two only properties which are not affected by the {{cssxref("all")}} shorthand property.</p>
<h2 id="Syntax">Syntax</h2>
<pre class="brush:css no-line-numbers">/* Keyword values */
direction: ltr;
direction: rtl;
/* Global values */
direction: inherit;
direction: initial;
direction: unset;
</pre>
<h3 id="Values">Values</h3>
<dl>
<dt><code>ltr</code></dt>
<dd>Text and other elements go from left to right. This is the default value.</dd>
<dt><code>rtl</code></dt>
<dd>Text and other elements go from right to left.</dd>
</dl>
<p>For the <code>direction</code> property to have any effect on inline-level elements, the {{Cssxref("unicode-bidi")}} property's value must be <code>embed</code> or <code>override</code>.</p>
<h2 id="Formal_definition">Formal definition</h2>
<p>{{cssinfo}}</p>
<h2 id="Formal_syntax">Formal syntax</h2>
{{csssyntax}}
<h2 id="Examples">Examples</h2>
<h3 id="Setting_right-to-left_direction">Setting right-to-left direction</h3>
<pre class="brush: css">blockquote {
direction: rtl;
}
</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('CSS3 Writing Modes', '#direction', 'direction')}}</td>
<td>{{Spec2('CSS3 Writing Modes')}}</td>
<td>No change.</td>
</tr>
<tr>
<td>{{SpecName('CSS2.1', 'visuren.html#direction', 'direction')}}</td>
<td>{{Spec2('CSS2.1')}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>
<p>{{Compat}}</p>
</div>
<h2 id="See_also">See also</h2>
<ul>
<li>{{Cssxref("unicode-bidi")}}</li>
<li>{{Cssxref("writing-mode")}}</li>
</ul>
|