Home >Web Front-end >JS Tutorial >A function implemented by javascript to automatically wrap text of a custom length. _javascript skills

A function implemented by javascript to automatically wrap text of a custom length. _javascript skills

WBOY
WBOYOriginal
2016-05-16 19:09:271501browse

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


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn