X

Headline

This is an important message requiring you to make a choice if you're based in the EU.

CSS text-justify Property

The text-justify property defines the behavior of spacing between words or characters.

The text-justify property is one of the CSS3 properties.

The text-justify property selects the justification method of text when text-align is set to "justify".

Initial Value auto
Applies to Inline-level and table-cell elements.
Inherited Yes.
Animatable No
Version CSS3
DOM Syntax object.style.textJustify = "inter-character";

Syntax

text-justify: auto | inter-word | inter-character | none | initial | inherit;

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      div {
      text-align: justify;
      text-justify: auto;
      }
    </style>
  </head>
  <body>
    <h2>Text-justify property example</h2>
    <div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
  </body>
</html>

Another example with "inter-character" value. Resize the browser to see how "justify" works:

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      div {
      text-align: justify;
      text-justify: inter-character;
      }
    </style>
  </head>
  <body>
    <h2>Text-justify property example</h2>
    <div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
  </body>
</html>

Values

Value Description
auto Justification algorithm is defined. This is the default value of this property.
inter-word The browser increases the space between words. This is typical for languages.
inter-character The browser increases the space between characters.
none Justification is deactivated.
distribute Has the same function as inter-word. This value is kept for backwards compatibility.
initial Makes the property use its default value.
inherit Inherits the property from its parents element.

Browser support

x x 55.0+ x x

Practice Your Knowledge

The text-justify property selects the justification method of text when



Do you find this helpful?

Related articles