CSS 对齐跨度标签内的文本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2361298/
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
Justify text inside span tags
提问by Anant
I have a markup like this
我有这样的标记
<div><span>My name is</span><span>ABC</span></div>
How can I justify this text on the whole line?
我怎样才能在整行上证明这段文字的合理性?
回答by animuson
<div style="text-align: justify"><span>My name is</span><span>ABC</span></div>
Pretty simple, the spans will not break the text justification. If text is only one line long, it is not possible to justify it across the entire line. As well, the last line of a paragraph cannot be justified across the entire line either.
非常简单,跨度不会破坏文本对齐。如果文本只有一行长,则不可能在整行中对齐它。同样,段落的最后一行也不能在整行中对齐。
回答by Marc Juchli
My solution:
我的解决方案:
<span style="text-align: justify; display:block;">Your Text</span>
回答by Dono
It is possible to justify a single line of text, but it might get ugly. It is possible by using the CSS3 text-justify
property that were added for Asian and non Latin languages.
可以证明一行文本是合理的,但它可能会变得丑陋。可以使用text-justify
为亚洲和非拉丁语言添加的 CSS3属性。
There's the link for a description of the properties : http://www.w3.org/TR/css3-text/#text-justify
有属性描述的链接:http: //www.w3.org/TR/css3-text/#text-justify