CSS text align justify big spaces

2019-01-08 23:34发布

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

Example of big spaces: http://jsfiddle.net/L5drN/

标签: css justify
4条回答
乱世女痞
2楼-- · 2019-01-09 00:05

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.

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 3 WD).

查看更多
啃猪蹄的小仙女
3楼-- · 2019-01-09 00:17

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-align CSS tag?

text-align:center

Or the word-spacing CSS tag?

word-spacing:10px
查看更多
▲ chillily
4楼-- · 2019-01-09 00:19

Give negative values as you prefer for word-spacing..

ex:

text-align:justify;
word-spacing:-2px;

Works for me and Hope this helps :)

查看更多
冷血范
5楼-- · 2019-01-09 00:21

Use:

word-break: break-all;

And Ok!

查看更多
登录 后发表回答