HTML - How to have paragraph split into equally wide lines?

杀马特。学长 韩版系。学妹 提交于 2019-12-01 03:17:18

问题


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?


回答1:


You might try fmt or par:

fmt -w 80 input.txt

or

par 80jl < input.txt

Another option would be to use the justify.vim Vim script.




回答2:


Try out the following css statement: text-align:justify;

or see the different options in action here.



来源:https://stackoverflow.com/questions/6996340/html-how-to-have-paragraph-split-into-equally-wide-lines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!