CSS 文本对齐对齐大空格
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15118540/
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
CSS text align justify big spaces
提问by Wizard
To format paragraphs I use text-align:justify
, but I have one problem that there are big spaces between words, for IE the solution is to use text-justify: distribute;
, but Chrome doesn't support this, my question is what should I use for Chrome and Firefox
要格式化我使用的段落text-align:justify
,但我有一个问题,单词之间有很大的空格,对于 IE,解决方案是使用text-justify: distribute;
,但 Chrome 不支持这一点,我的问题是我应该为 Chrome 和 Firefox 使用什么
Example of big spaces: http://jsfiddle.net/L5drN/
大空间示例:http: //jsfiddle.net/L5drN/
采纳答案by Jukka K. Korpela
Consider using hyphenation (manual, CSS, server-side, or client-side JavaScript), see e.g. answers to Can I use CSS to justify text with hyphenating words at the end of a line?Hyphenation tends to help a lot when there are long words in the text.
考虑使用连字符(手动、CSS、服务器端或客户端 JavaScript),参见例如我可以使用 CSS 来对齐在行尾带有连字符的文本的答案吗?当文本中有很长的单词时,连字符往往会有很大帮助。
You can still keep text-justify: distribute
, as it can improve the result on supporting browsers, and it can be expected to gain support, as it in the CSS standardization track (in CSS Text Module Level 3WD).
您仍然可以保留text-justify: distribute
,因为它可以改进支持浏览器的结果,并且有望获得支持,就像在 CSS 标准化轨道(在CSS Text Module Level 3WD)中一样。
回答by Laksh
Give negative values as you prefer for word-spacing..
根据您喜欢的字间距给出负值。
ex:
前任:
text-align:justify;
word-spacing:-2px;
Works for me and Hope this helps :)
对我有用,希望这有帮助:)
回答by Giovanny Gonzalez
Use:
用:
word-break: break-all;
断字:断断续续;
And Ok!
好吧!
回答by Anoop P S
text-align: justify;
text-justify: distribute;
text-align-last: left;
hope this will help you
希望能帮到你
回答by Adam Brown
How do you want to format the paragraphs? Do you mean the width, height, letter spacing or word spacing?
你想如何格式化段落?你是指宽度、高度、字母间距还是字间距?
Have you tried using the text-alignCSS tag?
您是否尝试过使用 text-alignCSS 标签?
text-align:center
Or the word-spacingCSS tag?
还是字间距CSS 标签?
word-spacing:10px