aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/css/ruby-align/index.html
blob: ec65055228bf22ed54da60976b7675fcbb680322 (plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
---
title: ruby-align
slug: Web/CSS/ruby-align
translation_of: Web/CSS/ruby-align
---
<div>{{CSSRef}}{{SeeCompatTable}}</div>

<h2 id="Summary">Summary</h2>

<p>The <code><strong>ruby-align</strong></code> CSS property defines the distribution of the different ruby elements over the base.</p>

<p>{{cssinfo}}</p>

<h2 id="Syntax">Syntax</h2>

<pre class="brush:css">/* Keyword values */
ruby-align: start;
ruby-align: center;
ruby-align: space-between;
ruby-align: space-around;

/* Global values */
ruby-align: inherit;
ruby-align: initial;
ruby-align: unset;
</pre>

<h3 id="Values">Values</h3>

<dl>
 <dt><code>start</code></dt>
 <dd>Is a keyword indicating that the ruby will be aligned with the start of the base text.</dd>
 <dt><code>center</code></dt>
 <dd>Is a keyword indicating that the ruby will be aligned at the middle of the base text</dd>
 <dt><code>space-between</code></dt>
 <dd>Is a keyword indicating that the extra space will be distributed between the elements of the ruby.</dd>
 <dt><code>space-around</code></dt>
 <dd>Is a keyword indicating that the extra space will be distributed between the elements of the ruby, and around it.</dd>
</dl>

<h3 id="Formal_syntax">Formal syntax</h3>

{{csssyntax}}

<h2 id="Examples">Examples</h2>

<p>This HTML will render differently with each value of <code>ruby-align</code>:</p>

<pre class="brush: html">&lt;ruby&gt;
  &lt;rb&gt;This is a long text to check&lt;/rb&gt;
  &lt;rp&gt;&lt;/rp&gt;&lt;rt&gt;short ruby&lt;/rt&gt;&lt;rp&gt;&lt;/rp&gt;
&lt;/ruby&gt;
</pre>

<h3 id="Ruby_aligned_at_the_start_of_the_base_text">Ruby aligned at the start of the base text</h3>

<pre class="brush: html" style="display: none;">&lt;ruby&gt;
  &lt;rb&gt;This is a long text to check&lt;/rb&gt;
  &lt;rp&gt;&lt;/rp&gt;&lt;rt&gt;short ruby&lt;/rt&gt;&lt;rp&gt;&lt;/rp&gt;
&lt;/ruby&gt;
</pre>

<pre class="brush: css">ruby {
    ruby-align:start;
}</pre>

<p>This gives the following result:</p>

<p>{{EmbedLiveSample("Ruby_aligned_at_the_start_of_the_base_text", 180, 40)}}</p>

<h3 id="Ruby_aligned_at_the_center_of_the_base_text">Ruby aligned at the center of the base text</h3>

<pre class="brush: html" style="display: none;">&lt;ruby&gt;
  &lt;rb&gt;This is a long text to check&lt;/rb&gt;
  &lt;rp&gt;&lt;/rp&gt;&lt;rt&gt;short ruby&lt;/rt&gt;&lt;rp&gt;&lt;/rp&gt;
&lt;/ruby&gt;
</pre>

<pre class="brush: css">ruby {
    ruby-align:center;
}</pre>

<p>This gives the following result:</p>

<p>{{EmbedLiveSample("Ruby_aligned_at_the_center_of_the_base_text", 180, 40)}}</p>

<h3 id="Extra_space_distributed_between_ruby_elements">Extra space distributed between ruby elements</h3>

<pre class="brush: html" style="display: none;">&lt;ruby&gt;
  &lt;rb&gt;This is a long text to check&lt;/rb&gt;
  &lt;rp&gt;&lt;/rp&gt;&lt;rt&gt;short ruby&lt;/rt&gt;&lt;rp&gt;&lt;/rp&gt;
&lt;/ruby&gt;
</pre>

<pre class="brush: css">ruby {
    ruby-align:space-between;
}</pre>

<p>This gives the following result:</p>

<p>{{EmbedLiveSample("Extra_space_distributed_between_ruby_elements", 180, 40)}}</p>

<h3 id="Extra_space_distributed_between_and_around_ruby_element">Extra space distributed between and around ruby element</h3>

<pre class="brush: html" style="display: none;">&lt;ruby&gt;
  &lt;rb&gt;This is a long text to check&lt;/rb&gt;
  &lt;rp&gt;&lt;/rp&gt;&lt;rt&gt;short ruby&lt;/rt&gt;&lt;rp&gt;&lt;/rp&gt;
&lt;/ruby&gt;
</pre>

<pre class="brush: css">ruby {
    ruby-align:space-around;
}</pre>

<p>This gives the following result:</p>

<p>{{EmbedLiveSample("Extra_space_distributed_between_and_around_ruby_element", 180, 40)}}</p>

<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 Ruby', '#ruby-align-property', 'ruby-align') }}</td>
   <td>{{ Spec2('CSS3 Ruby') }}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2>

<p>{{ CompatibilityTable() }}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td rowspan="1">Basic support</td>
   <td rowspan="1">{{ CompatNo }} </td>
   <td>{{CompatGeckoDesktop(38)}}</td>
   <td rowspan="1">{{ CompatNo }} [1]</td>
   <td rowspan="1">{{ CompatNo }} </td>
   <td rowspan="1">{{ CompatNo }}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Phone</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatNo }} </td>
   <td>{{CompatGeckoMobile(38)}}</td>
   <td>{{ CompatNo }} [1]</td>
   <td>{{ CompatNo }} </td>
   <td>CompatNo</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] Internet Explorer, since IE9, implements an early draft of CSS Ruby where <code>ruby-align</code> had the following properties: <code>auto</code>, <code>left</code>, <code>center</code>, <code>right</code>, <code>distribute-letter</code>, <code>distribute-space</code>, and <code>line-edge</code>. Here is a rough conversion table:</p>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">IE syntax</th>
   <th scope="col">Standard syntax</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td><code>auto</code></td>
   <td>Don't use <code>ruby-align</code></td>
  </tr>
  <tr>
   <td><code>left</code></td>
   <td>Use <code>start</code> (in ltr scripts)</td>
  </tr>
  <tr>
   <td><code>center</code></td>
   <td><code>center</code></td>
  </tr>
  <tr>
   <td><code>right</code></td>
   <td>Use <code>start</code> (in rtl scripts)</td>
  </tr>
  <tr>
   <td><code>distribute-letter</code></td>
   <td>No direct equivalent, use <code>space-between</code> or <code>space-around</code></td>
  </tr>
  <tr>
   <td><code>distribute-space</code></td>
   <td><code>space-around</code></td>
  </tr>
  <tr>
   <td><code>line-edge</code></td>
   <td>No direct equivalent.</td>
  </tr>
 </tbody>
</table>

<h2 id="See_also">See also</h2>

<ul>
 <li>HTML Ruby elements: {{HTMLElement("ruby")}}, {{HTMLElement("rt")}}, {{HTMLElement("rp")}}, and {{HTMLElement("rtc")}}.</li>
 <li>CSS Ruby properties: {{cssxref("ruby-position")}}, {{cssxref("ruby-merge")}}.</li>
</ul>