Stop word-wrap dividing words

前端 未结 12 1289
南方客
南方客 2020-12-16 11:00
body { word-wrap: break-word;}

I\'ve been using that code (above) to fit the text in the body into it\'s container. However what I don

相关标签:
12条回答
  • 2020-12-16 11:33

    I had the same problem, I solved it using following css:

    .className {
      white-space:pre-wrap;
      word-break:break-word;
    }
    
    0 讨论(0)
  • 2020-12-16 11:35

    In my situation I am trying to ensure words wrap at proper word-breaks within table cells.

    I found I need the following CSS to achieve this.

    table {
      table-layout:fixed;
    }
    td {
      white-space: wrap;
    }
    

    also check that nothing else is changing word-break to break-word instead of normal.

    0 讨论(0)
  • 2020-12-16 11:35

    Word break issue on Firefox browser. So you can use to prevent word-break:

    -webkit-hyphens: none;
    -moz-hyphens: none;
    hyphens: none;
    
    0 讨论(0)
  • 2020-12-16 11:37

    For me, the parent was smaller than the word. Adding will break on spaces, but not words :

        word-break: initial;
    
    0 讨论(0)
  • 2020-12-16 11:39

    I faced a similar problem in my grid structure and I used, word-break: break-word; in my grid and my issue got resolved.

    0 讨论(0)
  • 2020-12-16 11:41

    You can try this...

    body{
    white-space: pre; /* CSS2 */
    white-space: -moz-pre-wrap; /* Mozilla */
    white-space: -hp-pre-wrap; /* HP printers */
    white-space: -o-pre-wrap; /* Opera 7 */
    white-space: -pre-wrap; /* Opera 4-6 */
    white-space: pre-wrap; /* CSS 2.1 */
    white-space: pre-line; /* CSS 3 (and 2.1 as well, actually) */
    word-wrap: break-word; /* IE */
    }
    

    {word-wrap:;} is an IE proprietary property, and not a part of css. firefox's handling is correct. Unfortunately, FF does not support a soft hyphen / . so that's not an option. You could possibly insert a hair or thin space,  /  (check me on the numeric entity) and  / , respectively.

    Making {overflow: hidden;} would cut the overflow off, and {overflow: auto;} would cause the overflow to enable scrolling.

    0 讨论(0)
提交回复
热议问题