Text-Align Justify but to the Right?

We want to make text-align:justify, to take all the width of the column, but it should start from the right side. Is there any way to make it with css or somehow?.

EDIT:

As suggested

.text {
  text-align: justify;
  direction:rtl;
}

works, but it has punctuation issue.

SOLVED

    <span style="float:right">...</span>

This to be attached in the end has solved the punctuation issue. Thanks for effort though to everyone! I shall accept the first answer then.

4

7 Answers

I believe you might want something like this:

direction:rtl;
text-align:justify;

Example:

9
text-align-last: right;
-moz-text-align-last: right;

If I understand the question correctly, the issue is really just how to right-align the last line of a justified block of text. The above does just that, using a property in CSS 3 Text (with a vendor prefix version for better support), supported by modern browsers though not universally.

Though setting the writing direction to right-to-left causes this, among other things, it has several other, more fundamental effects. You may get away with it, if you don’t ever have inherently right-to-left characters in the text.

1

It can be solved by adding text-align-last:

div.a {
    text-align: justify;  /* For Edge */
    text-align-last: right;
}

Source: link

0

The best solution is:

p{
text-align: justify;
text-align-last: right;
}
<p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. 'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in this world haven't had the advantages that you've had.'</p>

Only there is a problem with the last punctuation mark.

check this sample

for right-to-left you just need to set direction:rtl

Just try this.

text-align:right justify;
direction:rtl; 
1

CSS

text-align: justify; 
text-align: right; // or text-align: left right; 
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest