-1

我想通过 < p > 循环并调整每个自动(!)和 < br> 换行符的大小小于例如。85% 但更大 50% 仅在字/字母间距为父容器的 100% 宽度的情况下 - 如果它不是 < p > 之前的最后一行。

所以当我有:

<div width="200px"><p>
This will be displayed in a monospaced font. The first four spaces
will be stripped off, but all other whitespace will preserved.<br />
will be off, but all other whitespace will preserved.<br />
Markdown and HTML are off in code blocks:<br />
This is not italic</i>, [this is not a link](http://example.com)
This is not italic</i>, [this is a link](http://example.com)
End of it.
</p></div>

应该:

...<p>
This will be displayed in a monospaced font. The first four spaces
will  be stripped off, but  all other  whitespace  will  preserved.<br />
will   be   off,  but   all   other   whitespace   will  preserved.<br />
Markdown and HTML are off in code blocks:<br />
This  is not italic</i>,  [this is not  a link](http://example.com)
This   is  not  italic</i>,  [this is  a link] (http://example.com)
End of it.
</p>...

当我使用 text-align justify 时,没有添加字间距,我想要一个“真实”的对齐文本。我现在真的搜索了很多天,但我没有找到任何我想要的代码。

也许有人可以帮助我:)

4

1 回答 1

0

DOM 中没有“线”之类的东西。这意味着您不能简单地遍历 javascript 解决方案中的行。也许您可以估计特定字体的行数,但这不是一个好的解决方案。对于“真实”的对齐文本,您应该使用text-align: justify;.

另外,我建议看一下这个问题的答案:我应该避免使用“text-align: justify;”吗?

于 2013-12-11T10:46:51.673 回答