Text Align: Justify

The text-align property is fairly well known in the world of CSS, even among those just starting out with the language. Values such as center, left and right are used often with this property, but a more forgotten option is justify.

What does justif…


This content originally appeared on Ugly Duck and was authored by Bradley Taunt

The text-align property is fairly well known in the world of CSS, even among those just starting out with the language. Values such as center, left and right are used often with this property, but a more forgotten option is justify.

What does justify do?

The MDN web docs define the justify value for text-align as such:

The inline contents are justified. Text should be spaced to line up its left and right edges to the left and right edges of the line box, except for the last line.

MDN web docs

See it in action

See the Pen Text Align: Justify by Bradley Taunt (@bradleytaunt) on CodePen.

When should I use this?

It isn’t always appropriate to use justify in most instances, although it becomes very useful for long form articles or blog posts. Since it takes a heavy influence from original print book layouts, the justify value helps improve readability for larger chunks of content.

Fair warning: it is best to remove any justify values when targeting smaller screen sizes. Mobile devices and/or tablets tend to be small enough to break up the content already. This CSS value is better suited for larger viewports.

Browser support

The good news is that all major browsers support the justify value for the text-align CSS property. So have some worry-free fun with it!


This content originally appeared on Ugly Duck and was authored by Bradley Taunt


Print Share Comment Cite Upload Translate Updates
APA

Bradley Taunt | Sciencx (2019-05-22T00:00:00+00:00) Text Align: Justify. Retrieved from https://www.scien.cx/2019/05/22/text-align-justify/

MLA
" » Text Align: Justify." Bradley Taunt | Sciencx - Wednesday May 22, 2019, https://www.scien.cx/2019/05/22/text-align-justify/
HARVARD
Bradley Taunt | Sciencx Wednesday May 22, 2019 » Text Align: Justify., viewed ,<https://www.scien.cx/2019/05/22/text-align-justify/>
VANCOUVER
Bradley Taunt | Sciencx - » Text Align: Justify. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2019/05/22/text-align-justify/
CHICAGO
" » Text Align: Justify." Bradley Taunt | Sciencx - Accessed . https://www.scien.cx/2019/05/22/text-align-justify/
IEEE
" » Text Align: Justify." Bradley Taunt | Sciencx [Online]. Available: https://www.scien.cx/2019/05/22/text-align-justify/. [Accessed: ]
rf:citation
» Text Align: Justify | Bradley Taunt | Sciencx | https://www.scien.cx/2019/05/22/text-align-justify/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.