How can I wrap or break long text/word in a fixed width span?

前端 未结 7 2096
长发绾君心
长发绾君心 2020-12-22 22:27

I want to create a span with a fixed width that when I type any thing in the span like lgasdfjksdajgdsglkgsadfasdfadfasdfadsfasdfasddkgjk

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-22 23:05

    Try following css with addition of white-space:

    span {
        display: block;
        word-wrap:break-word;
        width: 50px;
        white-space: normal
    }
    

提交回复
热议问题