Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 926107 of writing-mode

  • Revision slug: Web/CSS/writing-mode
  • Revision title: writing-mode
  • Revision id: 926107
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{CSSRef}}{{SeeCompatTable}}

Summary

The writing-mode property defines whether lines of text are laid out horizontally or vertically and the direction in which blocks progress.

The property specifies the block flow direction, which is the direction in which block-level containers are stacked, and the direction in which inline-level content flows within a block container. Thus the writing-mode property also determines the ordering of block-level content.

{{cssinfo}}

Syntax

/* Keyword values */
writing-mode: horizontal-tb;
writing-mode: vertical-rl;
writing-mode: vertical-lr;

/* Global values */
writing-mode: inherit;
writing-mode: initial;
writing-mode: unset;

Values

horizontal-tb
Content flows horizontally from left to right, vertically from top to bottom. The next horizontal line is positioned below the previous line.
vertical-rl
Content flows vertically from top to bottom, horizontally from right to left. The next vertical line is positioned to the left of the previous line.
vertical-lr
Content flows vertically from top to bottom, horizontally from left to right. The next vertical line is positioned to the right of the previous line.
sideways-rl
Content flows vertically from top to bottom and all the glyphs, even those in vertical scripts, are set sideways toward the right.
sideways-lr
Content flows vertically from top to bottom and all the glyphs, even those in vertical scripts, are set sideways toward the left.
lr {{deprecated_inline}}
Deprecated except for SVG1 documents. For CSS, use horizontal-tb.
lr-tb {{deprecated_inline}}
Deprecated except for SVG1 documents. For CSS, use horizontal-tb.
rl {{deprecated_inline}}
Deprecated except for SVG1 documents. For CSS, use horizontal-tb.
tb {{deprecated_inline}}
Deprecated except for SVG1 documents. For CSS, use vertical-rl.
tb-rl {{deprecated_inline}}
Deprecated except for SVG1 documents. For CSS, use vertical-rl.

Formal syntax

{{csssyntax}}

Example

{{EmbedLiveSample("Example", 400, 430)}}

Specification

Specification Status Comment
{{SpecName("CSS3 Writing Modes", "#block-flow", "writing-mode")}} {{Spec2("CSS3 Writing Modes")}} Initial definition

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatVersionUnknown}} {{property_prefix("-webkit")}} {{CompatGeckoDesktop(41)}}[1][3] 9.0 {{property_prefix("-ms")}}[2] {{CompatVersionUnknown}} {{property_prefix("-webkit")}} 8.0 {{property_prefix("-webkit")}}
SVG 1.1 values lr, lr-tb, rl, tb, tb-rl {{CompatVersionUnknown}} {{CompatGeckoDesktop(43)}} 9.0 {{property_prefix("-ms")}}[2] {{CompatVersionUnknown}} {{CompatUnknown}}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatVersionUnknown}} {{CompatGeckoMobile(41)}} [1][3] {{CompatUnknown}} {{CompatUnknown}} 8.0 {{property_prefix("-webkit")}}
SVG 1.1 values lr, lr-tb, rl, tb, tb-rl {{CompatUnknown}} {{CompatUnknown}} {{CompatGeckoMobile(43)}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

[1] An experimental implementation was available since Gecko 36. It is governed by the preference layout.css.vertical-text.enabled, defaulting to false until Firefox 38. From Firefox 39 and Firefox 40, the preference was true for Nightly and DevTools editions only. Note that not all CSS widgets (e.g. tables) obey to it, yet.

[2] The implementation in Internet Explorer differs from the specification. See the related article in the Internet Explorer Dev Center.

[3] Bidirectional and rtl scripts are supported in vertical modes only since Gecko 42.

See also

  • SVG writing-mode attribute
  • {{Cssxref("direction")}}
  • {{Cssxref("unicode-bidi")}}

Revision Source

<div>{{CSSRef}}{{SeeCompatTable}}</div>

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

<p>The <strong><code>writing-mode</code></strong> property defines whether lines of text are laid out horizontally or vertically and the direction in which blocks progress.</p>

<p>The property specifies the <em>block flow direction</em>, which is the direction in which block-level containers are stacked, and the direction in which inline-level content flows within a block container. Thus the <code>writing-mode</code> property also determines the ordering of block-level content.</p>

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

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

<pre class="brush:css">
/* Keyword values */
writing-mode: horizontal-tb;
writing-mode: vertical-rl;
writing-mode: vertical-lr;

/* Global values */
writing-mode: inherit;
writing-mode: initial;
writing-mode: unset;
</pre>

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

<dl>
 <dt><code>horizontal-tb</code></dt>
 <dd>Content flows horizontally from left to right, vertically from top to bottom. The next horizontal line is positioned below the previous line.</dd>
 <dt><code>vertical-rl</code></dt>
 <dd>Content flows vertically from top to bottom, horizontally from right to left. The next vertical line is positioned to the left of the previous line.</dd>
 <dt><code>vertical-lr</code></dt>
 <dd>Content flows vertically from top to bottom, horizontally from left to right. The next vertical line is positioned to the right of the previous line.</dd>
 <dt><code>sideways-rl</code></dt>
 <dd>Content flows vertically from top to bottom and all the glyphs, even those in vertical scripts, are set sideways toward the right.</dd>
</dl>

<dl>
 <dt><code>sideways-lr</code></dt>
 <dd>Content flows vertically from top to bottom and all the glyphs, even those in vertical scripts, are set sideways toward the left.</dd>
 <dt><code>lr</code> {{deprecated_inline}}</dt>
 <dd>Deprecated except for SVG1 documents. For CSS, use <code>horizontal-tb</code>.</dd>
 <dt><code>lr-tb</code> {{deprecated_inline}}</dt>
 <dd>Deprecated except for SVG1 documents. For CSS, use <code>horizontal-tb</code>.</dd>
 <dt><code>rl</code> {{deprecated_inline}}</dt>
 <dd>Deprecated except for SVG1 documents. For CSS, use <code>horizontal-tb</code>.</dd>
 <dt><code>tb</code> {{deprecated_inline}}</dt>
 <dd>Deprecated except for SVG1 documents. For CSS, use <code>vertical-rl</code>.</dd>
 <dt><code>tb-rl</code> {{deprecated_inline}}</dt>
 <dd>Deprecated except for SVG1 documents. For CSS, use <code>vertical-rl</code>.</dd>
</dl>

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

<pre class="syntaxbox">
{{csssyntax}}</pre>

<h2 id="Example">Example</h2>

<div class="hidden">
<pre class="brush: html">
&lt;table&gt;
    &lt;tr&gt;
        &lt;th&gt;value&lt;/th&gt;
        &lt;th&gt;Vertical script&lt;/th&gt;
        &lt;th&gt;Horizontal script&lt;/th&gt;
        &lt;th&gt;Mixed script&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;horizontal-tb&lt;/td&gt;
        &lt;td class="exampleText1"&gt;我家没有电脑。&lt;/td&gt;
        &lt;td class="exampleText1"&gt;Example text&lt;/td&gt;
        &lt;td class="exampleText1"&gt;1994年に至っては&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;vertical-lr&lt;/td&gt;
        &lt;td class="exampleText2"&gt;我家没有电脑。&lt;/td&gt;
        &lt;td class="exampleText2"&gt;Example text&lt;/td&gt;
        &lt;td class="exampleText2"&gt;1994年に至っては&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;vertical-rl&lt;/td&gt;
        &lt;td class="exampleText3"&gt;我家没有电脑。&lt;/td&gt;
        &lt;td class="exampleText3"&gt;Example text&lt;/td&gt;
        &lt;td class="exampleText3"&gt;1994年に至っては&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;sideways-lr&lt;/td&gt;
        &lt;td class="exampleText4"&gt;我家没有电脑。&lt;/td&gt;
        &lt;td class="exampleText4"&gt;Example text&lt;/td&gt;
        &lt;td class="exampleText4"&gt;1994年に至っては&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td&gt;sideways-rl&lt;/td&gt;
        &lt;td class="exampleText5"&gt;我家没有电脑。&lt;/td&gt;
        &lt;td class="exampleText5"&gt;Example text&lt;/td&gt;
        &lt;td class="exampleText5"&gt;1994年に至っては&lt;/td&gt;
    &lt;/tr&gt;
</pre>

<pre class="brush:css;">
table { border-collapse:collapse; }
td, th {border: 1px black solid; padding: 3px; }
th {background-color: lightgray; }
.exampleText1 { width:75px; writing-mode: horizontal-tb;}
.exampleText2 { height:75px; writing-mode: vertical-lr; }
.exampleText3 { height:75px; writing-mode: vertical-rl; }
.exampleText4 { height:75px; writing-mode: sideways-lr; }
.exampleText5 { height:75px; writing-mode: sideways-rl; }</pre>
</div>

<p>{{EmbedLiveSample("Example", 400, 430)}}</p>

<h2 id="Specification">Specification</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", "#block-flow", "writing-mode")}}</td>
   <td>{{Spec2("CSS3 Writing Modes")}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="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</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}} {{property_prefix("-webkit")}}</td>
   <td>{{CompatGeckoDesktop(41)}}<sup>[1][3]</sup></td>
   <td>9.0 {{property_prefix("-ms")}}<sup>[2]</sup></td>
   <td>{{CompatVersionUnknown}} {{property_prefix("-webkit")}}</td>
   <td>8.0 {{property_prefix("-webkit")}}</td>
  </tr>
  <tr>
   <td>SVG 1.1 values <code>lr</code>, <code>lr-tb</code>, <code>rl</code>, <code>tb</code>, <code>tb-rl</code></td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoDesktop(43)}}</td>
   <td>9.0 {{property_prefix("-ms")}}<sup>[2]</sup></td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoMobile(41)}} <sup>[1][3]</sup></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>8.0 {{property_prefix("-webkit")}}</td>
  </tr>
  <tr>
   <td>SVG 1.1 values <code>lr</code>, <code>lr-tb</code>, <code>rl</code>, <code>tb</code>, <code>tb-rl</code></td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoMobile(43)}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] An experimental implementation was available since Gecko 36. It is governed by the preference <code>layout.css.vertical-text.enabled</code>, defaulting to <code>false</code> until Firefox 38. From Firefox 39 and Firefox 40, the preference was <code>true</code> for Nightly and DevTools editions only. Note that not all CSS widgets (e.g. tables) obey to it, yet.</p>

<p>[2] The implementation in Internet Explorer differs from the specification. See the <a href="https://msdn.microsoft.com/en-us/library/ie/ms531187%28v=vs.85%29.aspx">related article in the Internet Explorer Dev Center</a>.</p>

<p>[3] Bidirectional and rtl scripts are supported in vertical modes only since Gecko 42.</p>

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

<ul>
 <li>SVG <code><a href="/en-US/docs/Web/SVG/Attribute/writing-mode">writing-mode</a></code> attribute</li>
 <li>{{Cssxref("direction")}}</li>
 <li>{{Cssxref("unicode-bidi")}}</li>
</ul>
Revert to this revision