Home >Web Front-end >JS Tutorial >A function implemented by javascript to automatically wrap text of a custom length. _javascript skills
In the process of making web pages, many friends always find that sometimes some English words will stretch out the original tables and cause deformation. Although you can use style="table-layout:fixed;word-wrap:break-word;word-break :break-all" to solve this problem, but sometimes it will cause the content to be displayed incompletely and be hidden, and the automatic line wrapping effect will not be achieved.
So I wanted to write a function like this to fix this defect. This function is very simple, but here I just provide an idea to solve this problem.
function fnAddBr(id, iPerLineLen){.....}
id is the id of the text block to be modified, iPerLineLen is the length of each line