How to find where browser breaks a paragraph of text

后端 未结 5 1594
谎友^
谎友^ 2021-01-19 03:46

I need to add line breaks in the positions that the browser naturally adds a newline in a paragraph of text.

For example:

This is some very long tex

5条回答
  •  余生分开走
    2021-01-19 04:10

    I would suggest wrapping all spaces in a span tag and finding the coordinates of each tag. When the Y-value changes, you're on a new line.

提交回复
热议问题