Anees Ahmad
Anees Ahmad

Reputation: 131

CSS making text align left and justify at same time

Is there any way to make the text align left and justify as same time? Mean something like left-justify. Is there any way to achieve this? Thanks for help.

Upvotes: 7

Views: 34750

Answers (5)

Himanshu Saini
Himanshu Saini

Reputation: 812

You may be looking for left align for last line:

  text-align: justify;
  text-align-last: left;

Upvotes: 26

Larry Lawless
Larry Lawless

Reputation: 623

Here's an image, it has both left-justified (top left) and justified (top right) text.

enter image description here

To get the left justified text you would use text-align: justify; in you css.

In the latest versions of Chrome and IE you get justified text with the last line being left aligned using that css. I'm not sure how older browsers handle it.

You get 4 types of justified text in Photoshop, fully justified or last line being left, center or right aligned but browsers are only supporting left justified it seems. For right to left languages they probably have right-justifed text.

Upvotes: 3

Jon Schroeder
Jon Schroeder

Reputation: 317

Justified means that the text lines up on both edges. However, the last line of the text still will be positioned to the left or the right side.

So...

Left-Aligned

Lorem Ipsum is simply dummy text of the printing and       |
typesetting industry. Lorem Ipsum has been the industry's  |
standard dummy text ever since the 1500s, when an unknown  |
printer took a galley of type and scrambled it to make a   |
type specimen book.                                        |

Left-Justified

                                                           |
Lorem  Ipsum  is  simply  dummy  text  of  the printing  and 
typesetting  industry. Lorem  Ipsum has been  the industry's 
standard dummy  text ever since  the 1500s, when  an unknown 
printer took  a galley of type  and scrambled  it to make  a 
type specimen book.                                        |
                                                           |

Right-Justified

                                                           |
Lorem  Ipsum  is  simply  dummy  text  of  the printing  and 
typesetting  industry. Lorem  Ipsum has been  the industry's 
standard dummy  text ever since  the 1500s, when  an unknown 
printer took  a galley of type  and scrambled  it to make  a 
                                         type specimen book.
                                                           |

I've not had use for this in the past, so I'm not 100% sure if this particular behavior you'd like is supported by CSS. I'd think that this link from W3Schools would help, though: http://www.w3schools.com/cssref/css3_pr_text-justify.asp

Upvotes: 7

Ned Batchelder
Ned Batchelder

Reputation: 375484

Left-justified means that the left edge of the text is aligned. Justified text means that both the left edge and the right edge of the text is aligned. So "left-aligned and justified" is no different from "justified", so your question doesn't make any sense to us.

Left-aligned:

Four-score and seven years ago, our fathers 
brought forth on this continent a new nation, 
conceived in liberty, and dedicated to the 
proposition that all men are created equal.

Justified:

Four-score  and  seven years  ago, our fathers 
brought forth on this continent a  new nation, 
conceived  in  liberty, and  dedicated to  the 
proposition that all men are created equal.

Right-aligned:

  Four-score and seven years ago, our fathers 
brought forth on this continent a new nation, 
   conceived in liberty, and dedicated to the 
  proposition that all men are created equal.

Perhaps there's some other kind of alignments you're trying to achieve?

Upvotes: 9

ErJab
ErJab

Reputation: 6375

Justified text is always "left and right justified".

Upvotes: 3

Related Questions