HTML - How to have paragraph split into equally wi

2019-02-18 11:14发布

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?

2条回答
We Are One
2楼-- · 2019-02-18 11:42

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

or see the different options in action here.

查看更多
我想做一个坏孩纸
3楼-- · 2019-02-18 11:45

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.

查看更多
登录 后发表回答