search

Home  >  Q&A  >  body text

javascript - css layout problem, you can use flex

曾经蜡笔没有小新曾经蜡笔没有小新2801 days ago592

reply all(6)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-19 10:24:11

    Call this function to process the text

    function linefeed(text) {
        var l = text.length;
        if (l <= 3) {
            return text
        }
        var cut = Math.floor(l/2);
        return text.slice(0, cut) + '<br>' + text.slice(cut)
    }

    reply
    0
  • PHP中文网

    PHP中文网2017-05-19 10:24:11

    The text and pictures are all taken from the interface

    Then make logical judgment directly in js, why should we use css to solve it

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:24:11

    Style settings

    p {
        white-space: nowrap
    }
    

    Then in the retrieved data, determine the length of the text. If it is greater than two, add the <br> newline character after the second text

    reply
    0
  • PHPz

    PHPz2017-05-19 10:24:11

    Use flex vertically and horizontally to set the text p size separately

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-19 10:24:11

    Add newline character with js

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:24:11


    wrap-reverse can reverse the first and second lines

    reply
    0
  • Cancelreply