HTML - 如何将段落分成同样宽的行?
这是关于基本的 HTML+CSS 页面渲染。
当一个段落太长而无法在一行中容纳时,它会尽可能多地占据空间,然后换行,如此反复。
我希望我的网页能够进行换行,以便生成的行尽可能相等。
所以不要得到:
包裹包裹包裹包裹包裹
包裹包裹包裹包裹包裹
包裹包裹包裹包裹包裹
换行
一行很短,我
包裹包裹包裹包裹
包裹包裹包裹包裹
包裹包裹包裹包裹
包裹包裹包裹包裹
(Rap Wrap Inp)更加平衡。例如,这对于右对齐的引用可能很有用,这些引用可能会或可能不会被包装,但如果稍微包装一下,就会看起来很难看。
所以我正在寻找一个 HTML/CSS 命令来告诉浏览器执行此操作。
备注:我并不是在寻找文本的合理性。我需要的是以大致相同大小的方式包裹线条,而不是最后一条短得多。
是否可以?
This is about basic HTML+CSS page rendering.
When a paragraph is too long to fit in one line, it occupies as much space as it can, then wraps, and again and so on.
I would like the line wrapping of my webpage to happen so that the resulting lines are as equal as possible.
So instead of getting:
wrap wrap wrap wrap wrap
wrap wrap wrap wrap wrap
wrap wrap wrap wrap wrap
wrap
with a very short last line, I would get:
wrap wrap wrap wrap
wrap wrap wrap wrap
wrap wrap wrap wrap
wrap wrap wrap wrap
with more balanced lines. This would be useful, for instance, for right-justified quotations that may or may not be wrapped, but look ugly when wrapped by just a little.
So I'm looking for a HTML/CSS command that tells the browsers to do this.
Remark: I'm not looking for the text to be justified. What I need is the lines to be wrapped in a way that they have roughly equal size rather than the last one being much shorter.
Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以尝试
fmt
或par
:或
另一种选择是使用 justify.vim Vim 脚本。
You might try
fmt
orpar
:or
Another option would be to use the justify.vim Vim script.
尝试以下 css 语句:
text-align:justify;
或 在此处查看不同的操作选项。
Try out the following css statement:
text-align:justify;
or see the different options in action here.
CSS 支持即将推出,但尚未实现准备广泛使用。实施情况各不相同。
以下内容适用于 Chrome,但不适用于 Safari(截至 2024 年 5 月)。
CSS support for this is coming, but is not yet ready for widespread use. Implementations vary.
The following works in Chrome but not in Safari (as at May 2024).