{"id":257413,"date":"2017-08-08T04:49:26","date_gmt":"2017-08-08T11:49:26","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=257413"},"modified":"2020-04-25T05:48:06","modified_gmt":"2020-04-25T12:48:06","slug":"text-justify","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/t\/text-justify\/","title":{"rendered":"text-justify"},"content":{"rendered":"\n
The Justified text is a fancy way of saying how text fills the box that contains it. In fact, you may already be well acquainted with justifying text and don’t even know it. If you have ever used text editing software like Word and Google Docs, then you might be familiar with these icons:<\/p>\n\n\n\n Those first three set the text alignment, just like the CSS That fourth icon is the justify option and it tells the content to fill the entire width of the document so that each line is flush right to the edge, regardless of whether it affects the spacing between words.<\/p>\n\n\n\n The text-justify<\/code> property in CSS is a companion to the
text-align<\/code><\/a> property that is used to set the justification method of text when
text-align<\/code> is set to the
justify<\/code> value.<\/p>\n\n\n\n
p {\n text-align: justify;\n text-justify: inter-word;\n}<\/code><\/pre>\n\n\n\n\n\n\n
Values<\/h3>\n\n\n
inter-word<\/code>: Specifies that text is justified by adjusting the spacing between words, effectively creating additional word spacing. This is effectively a variation of the
word-spacing<\/code><\/a> property.<\/li>
inter-character<\/code>: Specifies that text is justfiied by adjusting the spacing between characters, effectively creating additional character spacing. This is effectively a variation of the
letter-spacing<\/code><\/a> property.<\/li>
auto<\/code>: Allows the browser to determine whether justification is better handled as
inter-word<\/code> or
inter-character<\/code>. This can be helpful in multi-lingual scenarios where the content language is unknown until rendered, allowing the browser user agent to choose accordingly based on which method better fits the language context.<\/li>
none<\/code>: Disables justification methods, effectively removing any justification opportunities, or overriding where a justification method may occur in the cascade.<\/li><\/ul>\n\n\n\n
What exactly is justification?<\/h3>\n\n\n
text-align<\/code> property, where the text can be aligned to the left, right or completely centered.<\/p>\n\n\n\n
text-justify<\/code> property allows us to do the same, but with additional flexibility to determine whether the spacing method used to justify the content is managed between words or characters.<\/p>\n\n\n
Browser Support<\/h3>\n\n\n