Jquery 将<p>单词/字母间距为 100% 的文本扩展小于 85% 的行



我想通过<p>并调整每个自动(!)and<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>...

当我使用文本对齐对齐时,没有添加单词间距,我想要一个"真正的"对齐文本。我真的搜索了很多天,但我找不到任何符合我要求的代码。

也许有人可以帮我:)

DOM中没有"line"这样的东西。这意味着您不能简单地在javascript解决方案中循环使用行。也许您可以近似特定字体的行数,但这不是一个好的解决方案。对于"真实"的对齐文本,应使用text-align: justify;

此外,我建议看看这个问题的答案:我应该避免使用";文本对齐:对齐"?

最新更新