This topic has not yet been rated - Rate this topic

-ms-text-justify Attribute | textJustify Property

Gets or sets the type of alignment used to justify text in the object.

Syntax

CSS { -ms-text-justify : sAlign }
Scripting [ sAlign = ] object.style.textJustify

Possible Values

sAlign String that specifies or receives one of the following values.
auto
Default. Allows the browser to determine which justification algorithm to apply.
distribute
Handles spacing much like the newspaper value. This form of justification is optimized for documents in Asian languages, such as Thai.
distribute-all-lines
Justifies lines of text in the same way as the distribute value, except that it also justifies the last line of the paragraph. This form of justification is intended for ideographic text.
distribute-center-last
Not implemented.
inter-cluster
Justifies lines of text that contain no inter-word spacing. This form of justification is optimized for documents in Asian languages.
inter-ideograph
Justifies lines of ideographic text, and increases or decreases both inter-ideograph and inter-word spacing.
inter-word
Aligns text by increasing the space between words. This value's spacing behavior is the fastest way to make all lines of text equal in length. Its justification behavior does not affect the last line of the paragraph.
kashida
Justifies lines of text by elongating characters at chosen points. This form of justification is intended for Arabic script languages. Supported in Microsoft Internet Explorer 5.5 and later.
newspaper
Increases or decreases the spacing between letters and between words. It is the most sophisticated form of justification for Latin alphabets.

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 auto. The Cascading Style Sheets (CSS) attribute is inherited.

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

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

For this property to affect text layout, the textAlign property must be set to justify.

The property applies to block elements.

Examples

The following examples use the -ms-text-justify attribute and the textJustify property to align text within the object.

This example uses an inline style sheet to distribute all the lines within the object.


...
<DIV style="text-align:justify; text-justify:distribute-all-lines;">
    This example demonstrates how to use this property. This is
    something. This example demonstrates how to use this property.
    This is something. This example demonstrates how to this 
    property. This is something. This example demonstrates how to use this
    property. This is something. This example demonstrates how to
    use this property. This is something. This example demonstrates
    how to use this property. This is something. This example
    demonstrates how to use this property. This is something.
    This example demonstrates how to use this property. This is
    something. This example demonstrates how to use this property.
</DIV>                
...

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/text-justify.htm

This example uses inline scripting to change the alignment of the text when an onmouseover event occurs.


...
<DIV style="cursor:hand; text-align:justify;"
    onmouseover="this.style.textJustify='distribute-all-lines';"
    onmouseout="this.style.textJustify='auto';">
    This example demonstrates how to use this property. This is
    something. This example demonstrates how to use this property.
    This is something. This example demonstrates how to this 
    property. This is something. This example demonstrates how to use this
    property. This is something. This example demonstrates how to
    use this property. This is something. This example demonstrates
    how to use this property. This is something. This example
    demonstrates how to use this property. This is something.
    This example demonstrates how to use this property. This is
    something. This example demonstrates how to use this property.
</DIV>                
...

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

Standards Information

This property is defined in Cascading Style Sheets (CSS), Level 3 (CSS3).

Applies To

ADDRESS, BLOCKQUOTE, BODY, CENTER, CSSStyleDeclaration, currentStyle, DD, DIR, DIV, DL, DT, FIELDSET, FORM, hn, HR, LEGEND, LI, LISTING, MARQUEE, MENU, OL, P, PLAINTEXT, PRE, runtimeStyle, style, TABLE, TD, TH, TR, UL, XMP, CSSCurrentStyleDeclaration Constructor, CSSRuleStyleDeclaration Constructor, CSSStyleDeclaration Constructor
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ