Wrapping long text without white space inside of a div

后端 未结 4 1866
南旧
南旧 2021-01-01 09:09

I am having issues with wrapping text. I am generating some hexencoding encryption and the output is too long like:

827938828ey823876te37257e5t328er63

4条回答
  •  攒了一身酷
    2021-01-01 10:07

    I have found something strange here about word-wrap only works with width property of CSS properly.

    #ONLYwidth {
      width: 200px;
    }
    
    #wordwrapWITHOUTWidth {
      word-wrap: break-word;
    }
    
    #wordwrapWITHWidth {
      width: 200px;
      word-wrap: break-word;
    }
    This is the example of word-wrap only using width property
    

    827938828ey823876te37257e5t328er6367r5erd663275e65r532r6s3624e5645376er563rdr753624e544341763r567r4e56r326r5632r65sr32dr32udr56r634r57rd63725


    This is the example of word-wrap without width property

    827938828ey823876te37257e5t328er6367r5erd663275e65r532r6s3624e5645376er563rdr753624e544341763r567r4e56r326r5632r65sr32dr32udr56r634r57rd63725


    This is the example of word-wrap with width property

    827938828ey823876te37257e5t328er6367r5erd663275e65r532r6s3624e5645376er563rdr753624e544341763r567r4e56r326r5632r65sr32dr32udr56r634r57rd63725

    Here is a working demo that I have prepared about it. http://jsfiddle.net/Hss5g/2/

提交回复
热议问题