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

前端 未结 7 1966
长发绾君心
长发绾君心 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
    }
    
    0 讨论(0)
提交回复
热议问题