Should I avoid using “text-align: justify;”?

后端 未结 13 1118
离开以前
离开以前 2020-12-12 14:00

Is there any reason to avoid using text-align: justify;?

Does it reduce readability or cause problems?

13条回答
  •  渐次进展
    2020-12-12 14:15

    text-align: justify shouldn't be used in browsers at the moment. They aren't good at handling the minute details within and the output ends up containing lots of rivers and there's no support for hyphenation (other than soft hyphens).

    Note above was written 4.5 years ago. Things are slowly changing... http://caniuse.com/#feat=css-hyphens

    Edit: Hyphenator was brought to my attention in this answer's comments. It looks like it makes text-align justify worth using, check out the sites that use it. You may want to use javascript to apply text-align justify before using this script so that those without javascript don't get caught out.

    Edit 2: CSS now allows for hyphenation with the hyphens property [browser support]. PPK is now saying to add it to your stylesheets, whilst Eric Meyer says just add it for mobile.

    Edit 3: A good little overview of things available to us now, with some SASS.

提交回复
热议问题