当文本对齐时,移动视图中某些单词之间的间距太大 [英] Spacing between some words is just too big in mobile view when text is justified

查看:27
本文介绍了当文本对齐时,移动视图中某些单词之间的间距太大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个网站并准备启动它,但后来我注意到当在移动设备上显示时,文本中的某些单词之间的间距太大.是否可以以某种方式定义段落中的最大间距?

I made a website and I was ready to launch it but then I noticed that when displayed on mobile certain words in text have just too big spacing between them. Is it possible to somehow define maximum spacing in paragraph?

p {
  text-align:justify;
}

推荐答案

正是因为这个原因,对齐文本是危险的.有时,如果不在文本中制造巨大的空白,就无法证明是正当的.LaTeX 编译器实际上更喜欢扩展行(忽略例如页边距)而不是创建孔.

Justifying text is dangerous for exactly this reason. Sometimes you just cannot justify without creating huge gaps in the text. The LaTeX compiler actually prefers extending the line (ignoring e.g. page margins) instead of creating holes.

您可以尝试使用 hyphens CSS 属性来避免间隙,但请记住,此功能是新功能,可能并不总是有效.请参阅 https://css-tricks.com/almanac/properties/h/hyphenate/

You could try the hyphens CSS property to avoid gaps, but keep in mind that this feature is new and might not always work. See https://css-tricks.com/almanac/properties/h/hyphenate/

如果您绝对必须避免这些间隙,则必须调整容器的字体大小或宽度或编辑文本.但请记住要测试许多分辨率、屏幕宽度和缩放系数.您可能太忙而无法遵循这种方法,因此除了将文本左对齐或硬着头皮忍受空白之外,没有其他可行的解决方案.

You’d have to adjust the font size or width of your container or edit the text if you absolutely have to avoid these gaps. But keep in mind to test many resolutions, screen widths, and zoom factors. You’re probably too busy to follow this approach, so there is no feasible solution other than left-aligning your text or biting the bullet and live with the gaps.

这篇关于当文本对齐时,移动视图中某些单词之间的间距太大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆