How to divide text into columns, if I get text dynamically for database using Javascript and CSS?

后端 未结 3 685
北海茫月
北海茫月 2021-01-20 15:56

I think a script makes a certain number of characters in each container can work. Do you know any script like that? It is a responsive design I can use several css files but

3条回答
  •  不知归路
    2021-01-20 16:34

    you think something like this?

    var yourText = $('selector');
    $(yourText).each(function() {
        if ($(this).text().length >= 200) {
            $(this).text($(this).text().substring(0, 200)0);
        }
    });
    

    It wiil get the first 200 letters.. for the next 200 you need to switch the variables 0,200 to 200, 400 unfortunately it will split a word and does not recognize that some letters are wider than others...

提交回复
热议问题