8 out of 33 rated this helpful - Rate this topic

-ms-writing-mode Attribute | writingMode Property

Gets or sets the direction and flow of the content in the object.

Syntax

CSS { -ms-writing-mode : sFlow }
Scripting [ sFlow = ] object.style.writingMode [ = sFlow ]

Possible Values

sFlow String that specifies or receives one of the following values.
lr-tb
Default. Content flows horizontally from left to right, top to bottom. The next horizontal line is positioned underneath the previous line. All glyphs are positioned upright. This layout is used by most writing systems.
rl-tb
Content flows horizontally from right to left, top to bottom. The next horizontal line is positioned underneath the previous line. All glyphs are positioned upright. This layout is used with right-to-left scripts like Arabic, Hebrew, Thaana, and Syriac.
tb-rl
Content flows vertically from top to bottom, right to left. The next vertical line is positioned to the left of the previous line. Wide-cell glyphs are positioned upright; nonwide-cell glyphs (also known as narrow Latin or narrow Kana glyphs) are rotated 90° clockwise. This layout is used in East Asian typography.
bt-rl
Content flows vertically from bottom to top, right to left. The next vertical line is positioned to the left of the previous line. Wide-cell glyphs are positioned upright; nonwide-cell glyphs (also known as narrow Latin or narrow Kana glyphs) are rotated 90° clockwise. This layout is used for right-to-left script blocks used in vertical East Asian typography.
tb-lr
Windows Internet Explorer 8. Content flows vertically from top to bottom, left to right. The next vertical line is positioned to the right of the previous line.
bt-lr
Internet Explorer 8. Content flows vertically from bottom to top, left to right.
lr-bt
Internet Explorer 8. Content flows horizontally from bottom to top, left to right. The next horizontal line is positioned above the previous line.
rl-bt
Internet Explorer 8. Content flows horizontally from bottom to top, right to left.
lr New for Internet Explorer 9 
Internet Explorer 9. For use on Scalable Vector Graphics (SVG) and HTML elements. Equivalent to lr-tb.
rl New for Internet Explorer 9 
Internet Explorer 9. For use on SVG and HTML elements. Equivalent to rl-tb.
tb New for Internet Explorer 9 
Internet Explorer 9. For use on SVG and HTML elements. Equivalent to tb-rl.

The property is read/write for all objects except the following, for which it is read-only: currentStyle. The property has a default value of lr-tb. The Cascading Style Sheets (CSS) attribute is inherited by all objects with the following exceptions: BUTTON, CAPTION, INPUT, INPUT type=button, INPUT type=file, INPUT type=password, INPUT type=reset, INPUT type=submit, INPUT type=text, ISINDEX, OPTION, TEXTAREA.

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are supported in IE7 Standards mode and IE5 (Quirks) mode only. For more information, see About Dynamic Properties and Defining Document Compatibility.

Remarks

The following diagram shows how the different values for the property appear on the screen.

Visual comparison of writing modes

Internet Explorer 8. The -ms-writing-mode attribute is an extension to CSS and can be used as a synonym for writing-mode in IE8 Standards mode.

The property does not accumulate. That is, even if the writingMode property, set to the same value, is applied to an object multiple times, the writingMode property is effectively applied to the object only one time. For example, if a parent element has the writingMode property set to tb-rl, setting a child element's writingMode property to tb-rl does not cause the child element to double the effect of the writingMode property, or "rotate."

An element has its own layout if the value for the writingMode property is different than its parent. When a change in layout flow is specified for a child element, the maximum logical height requirement (height in this element's coordinate system) is determined by the available space (width measurement) in the parent's coordinate system. Based on this information, a logical width (width in the child's coordinate system) is computed to meet the maximum logical height requirement. Depending on the amount of space needed by the child element, the actual logical height of the element can be less than the maximum logical height requirement.

When you use elements that have different values for the writingMode property, you can have greater control over the layout of those elements by specifying fixed dimensions for each element.

Internet Explorer 7. The rl-tb, and bt-rl values are available to the writingMode.

Internet Explorer 7. The writingMode for the body element is limited to lr-tb and rl-tb.

Internet Explorer 8. Because writing-mode is currently defined by the World Wide Web Consortium (W3C) in a draft specification, -ms-writing-mode is preferred for style sheet validation, as in the following code example.


    .clsHorizLR { -ms-writing-mode:lr-tb }
    .clsHorizRL { -ms-writing-mode:rl-tb }
    .clsVertTB  { -ms-writing-mode:tb-rl }
    .clsVertBT  { -ms-writing-mode:bt-rl }

Example

The following example shows how to use the writingMode property to nest horizontal text inside vertical text.


<html><head><style>
    .clsHorizLR { writing-mode:lr-tb }
    .clsHorizRL { writing-mode:rl-tb }
    .clsVertTB  { writing-mode:tb-rl }
    .clsVertBT  { writing-mode:bt-rl }
</style></head><body>
<h1>writing-mode Attribute</h1>

<p>This example shows how to use the <b>writing-mode</b> attribute to display horizontal text (<span>lr-tb</span>) 
within vertical text (<span>tb-rl</span>).</p>
<p>The following <b>div</b> element has a <b>writing-mode</b> of tb-rl and contains text and <b>span</b> child elements. 
The text flow alternates between vertical and horizontal. Be aware of the effect of the <b>BR</b> element after the second 
set of vertical text.</p>

<div style="writing-mode:tb-rl">First Set of Vertical Text<span class="clsHorizLR">First Set of Horizontal Text</span>
Second Set of Vertical Text plus a line break<BR><span style="writing-mode:lr-tb">Second Set of Horizontal Text</span>
Third Set of Vertical Text<span class="clsHorizLR">Third Set of Horizontal Text</span>
</div><p>This example shows how to use the new <b>writing-mode</b> attribute to display horizontal text (<span>rl-tb</span>).<div class="clsHorizRL">Fourth Set of Horizontal Text</div><p>This example makes use of the new<b>writing-mode</b> attribute to display vertical text (<span>bt-rl</span>).<div class="clsVertBT">Fourth Set of 
Vertical Text</div>

</div></body></html>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/writingMode2.htm

Standards Information

This property is a Microsoft extension to Cascading Style Sheets (CSS).

Applies To

A, ABBR, ACRONYM, ADDRESS, B, BIG, BLOCKQUOTE, BUTTON, CAPTION, CENTER, CITE, CODE, CSSStyleDeclaration, currentStyle, CUSTOM, DD, DEL, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FONT, FORM, hn, HR, I, INPUT, INPUT type=button, INPUT type=file, INPUT type=password, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, MARQUEE, MENU, OL, OPTION, P, PLAINTEXT, popup, PRE, Q, RT, RUBY, runtimeStyle, S, SAMP, SMALL, SPAN, STRIKE, STRONG, style, SUB, SUP, TD, TEXTAREA, TH, TT, U, UL, VAR, CSSCurrentStyleDeclaration Constructor, CSSRuleStyleDeclaration Constructor, CSSStyleDeclaration Constructor
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ