文本对齐,但右对齐?

时间:2022-10-22 08:06:30

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?.

我们想要使文本对齐:合理地使用列的所有宽度,但是它应该从右边开始。有没有什么办法用css或者别的什么办法?

EDIT:

编辑:

As suggested http://jsfiddle.net/dVbJr/33/

建议http://jsfiddle.net/dVbJr/33/

.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.

最后附上的这句话解决了标点的问题。谢谢大家的努力!那么我接受第一个答案。

6 个解决方案

#1


27  

I believe you might want something like this:

我相信你可能想要这样的东西:

direction:rtl;
text-align:justify;

Example: http://jsfiddle.net/aew75/

例如:http://jsfiddle.net/aew75/

#2


12  

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.

如果我正确地理解了这个问题,那么真正的问题是如何正确地对齐文本块的最后一行。上述方法就是这样做的,使用CSS 3文本中的属性(使用供应商前缀版本以获得更好的支持),得到现代浏览器的支持,但并不普遍。

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.

虽然将书写方向设置为从右到左的原因,但除此之外,它还有其他一些更基本的影响。如果你在文本中没有固有的从右到左的字符,你可能会侥幸过关。

#3


0  

check this sample

检查这个样品

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

从右到左你只需要设置方向:rtl。

#4


-1  

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

它可以通过在这里添加text- alignlast来解决

#5


-3  

Just try this.

试试这个。

text-align:right justify;
direction:rtl; 

#6


-3  

CSS

CSS

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

#1


27  

I believe you might want something like this:

我相信你可能想要这样的东西:

direction:rtl;
text-align:justify;

Example: http://jsfiddle.net/aew75/

例如:http://jsfiddle.net/aew75/

#2


12  

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.

如果我正确地理解了这个问题,那么真正的问题是如何正确地对齐文本块的最后一行。上述方法就是这样做的,使用CSS 3文本中的属性(使用供应商前缀版本以获得更好的支持),得到现代浏览器的支持,但并不普遍。

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.

虽然将书写方向设置为从右到左的原因,但除此之外,它还有其他一些更基本的影响。如果你在文本中没有固有的从右到左的字符,你可能会侥幸过关。

#3


0  

check this sample

检查这个样品

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

从右到左你只需要设置方向:rtl。

#4


-1  

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

它可以通过在这里添加text- alignlast来解决

#5


-3  

Just try this.

试试这个。

text-align:right justify;
direction:rtl; 

#6


-3  

CSS

CSS

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