Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.