CSS Portal

CSS text-justify Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The text-justify property controls the algorithm a user agent uses to distribute extra inline space when a block of text is justified. It comes into play only when the alignment of lines is set to produce flush edges (for example, when text-align is set to justify), and its role is to determine how to spread or compress spacing within the line box so both edges appear aligned. Rather than specifying whether text is justified, it governs the technique the renderer applies to achieve that visual result.

Because justification can be achieved in multiple ways, the property influences whether the renderer adjusts inter-word gaps, modifies inter-character spacing, stretches glyphs (in some typesetting systems), or combines several tactics. That interaction often affects how hyphenation is used to avoid excessive gaps; accordingly, justification behavior is closely related to the settings for hyphens, which can allow or restrict breaking words to improve line fit. It also interacts with explicit spacing controls such as word-spacing and letter-spacing, because those properties establish baseline spacing that the justification algorithm may adjust from.

Practical consequences of different justification approaches include changes to perceived density, the emergence of "rivers" of white space through paragraphs, and legibility differences across languages and fonts. For scripts like East Asian text, justification frequently uses character redistribution or glyph-level adjustments rather than only expanding spaces between words, so the property’s effect depends on the script, font metrics, and line-breaking rules. Settings that favor larger inter-word gaps can harm reading rhythm in narrow columns, while choices that rely on tighter character spacing can make text look cramped; authors should consider the impact on readability for the target language and layout.

Finally, the property does not operate in isolation: it can be influenced by how white-space handling is configured and whether the layout allows flexible wrapping or forces unbroken lines. For example, interactions with white-space and the treatment of the last line (as affected by text-align-last) determine when and where the justification algorithm is applied and whether the last line receives the same distribution rules. Because justification decisions are ultimately renderer-dependent, testing with representative content and languages is the best way to confirm the visual and accessibility outcomes you want.

Definition

Initial value
auto
Applies to
block containers and, optionally, inline elements
Inherited
Yes
Computed value
Specified value
Animatable
No
JavaScript syntax
object.style.textJustify

Syntax

text-justify: auto | none | inter-word | distribute 

Values

  • autoAllows the browser to determine which justification algorithm to apply.
  • noneJustification is disabled.
  • inter-wordJustification adjusts spacing at word separators only (effectively varying the used word-spacing on the line). This behavior is typical for languages that separate words using spaces, like English or Korean.
  • inter-characterText is justified by adjusting the space between characters, maintaining consistent word spacing. This can result in irregular word spacing but even character spacing.
  • distribute DeprecatedJustification adjusts spacing between each pair of adjacent characters (effectively varying the used letter-spacing on the line). This value is sometimes used in Japanese.

Example

<div class="wrap">
<div class="box">
<p class="justified inter-word">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum vestibulum. Cras venenatis euismod malesuada.</p>
<p class="label">text-justify: inter-word</p>
</div>

<div class="box">
<p class="justified inter-character">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum vestibulum. Cras venenatis euismod malesuada.</p>
<p class="label">text-justify: inter-character</p>
</div>

<div class="box">
<p class="justified distribute">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lacinia odio vitae vestibulum vestibulum. Cras venenatis euismod malesuada.</p>
<p class="label">text-justify: distribute</p>
</div>
</div>
/* Layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    background: #f7f7f9;
    color: #222;
    padding: 24px;
}

.wrap {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.box {
    width: 320px;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

h2 {
    width: 100%;
    font-size: 18px;
    margin: 0 0 12px 0;
}

.label {
    margin-top: 10px;
    font-size: 13px;
    color: #555;
}

/* Justification examples */
.justified {
    margin: 0;
    line-height: 1.5;
    text-align: justify;            /* required to enable justification */
    -ms-text-justify: distribute;   /* IE specific */
}

.inter-word {
    text-justify: inter-word;       /* expand spaces between words */
}

.inter-character {
    text-justify: inter-character;  /* expand spacing between characters */
}

.distribute {
    text-justify: distribute;      /* distribute spacing across the line (varies by UA) */
}

/* Make the last line fully justified in supporting UAs */
.box .justified {
    text-align-last: justify;
}

Browser Support

The following information will show you the current browser support for the CSS text-justify property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported in some modern browsers, but not all.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!