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...
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.
7 Answers
I believe you might want something like this:
direction:rtl;
text-align:justify;
Example:
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.
It can be solved by adding text-align-last:
div.a {
text-align: justify; /* For Edge */
text-align-last: right;
}
Source: link
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;
CSS
text-align: justify;
text-align: right; // or text-align: left right;