text-justify property

Specifies the type of alignment used to justify text in the object.

CSS Text Level 3Internet Explorer 9

 

Syntax

text-justify: auto | distribute | distribute-all-lines | distribute-center-last | inter-cluster | inter-ideograph | inter-word | kashida | newspaper

Property 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 starting in Internet Explorer 5.5.

newspaper

Increases or decreases the spacing between letters and between words. It is the most sophisticated form of justification for Latin alphabets.

CSS information

Applies ToAll elements
Mediavisual
Inherited1
Initial Valueauto

Standards information

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 text-align property must be set to justify.

The property applies to block elements.

Examples

The following example uses the text-justify property to align text within the object.

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

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


<!DOCTYPE html>
<html>
<head>
  <title>text-justify Sample</title>
</head>

<body>
  <h1>text-justify Sample</h1>
  <p>This example uses an inline style sheet to distribute all the lines within the object - resize 
     the browser windows to see how the value <strong>justify</strong> works.</p>

  <div style="border: 1px solid black;">
    <div style="text-align: justify; text-justify: inter-word;">
      This example demonstrates how to use the textJustify property. This is something. 
      This example demonstrates how to use the textJustify property. 
      This is something. This example demonstrates how to use the textJustify property. This is something. 
      This example demonstrates how to use the textJustify property. This is something. 
      This example demonstrates how to use the textJustify property. This is something. 
      This example demonstrates how to use the textJustify property. This is something. 
      This example demonstrates how to use the textJustify property. This is something. 
      This example demonstrates how to use the textJustify property. This is something. 
      This example demonstrates how to use the textJustify property.</div>
  </div>
</body>
</html>

See also

CSSStyleDeclaration
currentStyle
runtimeStyle
style

 

 

Show:
© 2014 Microsoft