Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Foundations Text, Fonts, and Lists Text Properties

what are the advantages of using text-alignment:justify; over left,right and center?

in which cases it is better to use justify?

1 Answer

Justified text forces each line of text to have equivalent lengths by affecting the spacing between words. Justified text is typically left aligned. Justified text looks almost like a square.

Left align by itself forces text to be aligned to the left hand side of the page but only the left hand side is equally aligned, the right hand side will be noticeably different because no change has been made to character spacing. The right hand side will wrap when words get too long.

Right align does the same thing as left align except that the right hand side is equally aligned and the left hand side will wrap when words are too long.

Center align centers text on the page and neither the left or right side will be equally aligned.

Here is a demo page so that you can visually see how Justified looks over Left align: http://codepen.io/anon/pen/zxqjZV

thanks parson

If you deem my answer worthy of best answer, could you select it? :) I also edited it just a bit to explain a little more about right and center alignment that I forgot to mention.