How to mimic word-break: break-word; for IE9, IE11 and Firefox

前端 未结 3 785
醉酒成梦
醉酒成梦 2021-02-07 02:27

How to mimic word-break: break-word; for IE9, IE11 and Firefox?

It seems to work in Chrome. I have learnt and understood that it is a is non-standard, webki

相关标签:
3条回答
  • 2021-02-07 02:57

    Use display:table-caption to achieve what you are looking for.

    LIVE DEMO

    The HTML:

    <div id="grid2">
         <span id="theSpan">Product Support</span>
    </div>
    

    The CSS:

    #theSpan{
      display:table-caption;
    }
    

    Hope this helps.

    0 讨论(0)
  • 2021-02-07 02:58
    #grid2{
        white-space: pre-wrap;
        word-wrap: break-word;
    }
    

    This should work for IE11, but not for IE9

    0 讨论(0)
  • 2021-02-07 03:05

    I have had good success in Chrome, Firefox and IE with using only:

    word-break: break-word;
    word-wrap: break-word;
    

    In my problem case I was already using:

    display: table-cell;
    

    and I ended up having to include

    max-width: 440px;
    

    to get wrapping in all browsers. In most cases the max-width was not necessary.

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