Html 文本对齐对齐但向右?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10684533/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Text-align justify but to the right?
提问by Anonymous
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?.
我们想让 text-align:justify 占据列的所有宽度,但它应该从右侧开始。有什么办法可以用 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.
最后附上这个,解决了标点问题。感谢大家的努力!那么我将接受第一个答案。
回答by Jason Gennaro
I believe you might want something like this:
我相信你可能想要这样的东西:
direction:rtl;
text-align:justify;
Example: http://jsfiddle.net/aew75/
回答by Jukka K. Korpela
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 Text 中的属性(带有供应商前缀版本以获得更好的支持),现代浏览器虽然不普遍支持。
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.
尽管将书写方向设置为从右到左会导致这一点,但它还有其他几个更基本的影响。如果文本中从来没有固有的从右到左的字符,那么您可能会侥幸逃脱。
回答by Shobhit Verma
回答by Mironline
回答by iWizard
CSS
CSS
text-align: justify;
text-align: right; // or text-align: left right;
回答by mohana rao
Just try this.
试试这个。
text-align:right justify;
direction:rtl;