CSS Reference ยท Typography
The text-justify property
Reference for the CSS text-justify property: choose whether justified text stretches spaces between words or between characters. Limited browser support explained.
The text-justify property chooses how the browser stretches a line when text-align: justify is in effect. Extra space can be added between words, between individual characters, or the browser can pick whatever suits the language.
The property does nothing on its own: it only matters on text that is actually being justified. Support is limited, so treat it as an optional refinement and check a compatibility table before relying on it.
p { text-align: justify; text-justify: inter-word; }
Try it
In browsers that do not support the property, all three paragraphs are still justified, but they use the browser's default method. In browsers that support it, none turns justification off.
Syntax
text-justify: auto | none | inter-word | inter-character
- Initial value:
auto - Applies to: text
- Inherited: yes
- Animatable: no
- Computed value: as specified
Values
| Value | Description |
|---|---|
auto |
The browser chooses a method suited to the content. |
none |
Justification is disabled; the text behaves as if it were not justified. |
inter-word |
Space is added between words. This is the usual method for Latin scripts. |
inter-character |
Space is added between characters as well, which suits some other scripts, but can look awkward in English. |
Usage notes
- Needs
text-align: justify. Without it,text-justifyhas no visible effect. - Rivers of white space. Justified text in narrow columns creates uneven gaps. Combine justification with
hyphens: autoand a reasonable column width to reduce them. - Readability. Many readers find ragged-right text easier to read, especially in narrow columns or for people with dyslexia. Use justification when the layout really benefits from it.
- Last line. The final line of a paragraph is not stretched; use
text-align-lastto change that. - Do not depend on it. Because browsers differ, design so the page looks acceptable if
text-justifyis ignored.
Browser support
Support is uneven across engines, so check a compatibility table. Unsupported browsers simply justify with their default behavior.
Related
text-alignโ includingjustifytext-align-lastโ alignment of the last linehyphensโ automatic hyphenationletter-spacingandword-spacing- Lesson: Text Styling