简体   繁体   中英

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

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?

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.

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

or see the different options in action here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM