简体   繁体   English

自动换行不适用于百分比宽度

[英]word-wrap is not working with the width in percentage

I want to align to next to each other with width:48% . 我想与width:48%彼此对齐。 If there is text which has no spaces, the string should be broken. 如果文本中没有空格,则应将字符串断开。 Therefore, I added word-wrap:break-word . 因此,我添加了word-wrap:break-word

This won't work. 这行不通。 In Chrome, I get this working if I also add word-break:break-word . 在Chrome中,如果我还添加word-break:break-word ,则可以正常工作。 In IE, it would never work. 在IE中,它将永远无法工作。

Here is the fiddle: http://jsfiddle.net/e02k0d8e/ 这是小提琴: http : //jsfiddle.net/e02k0d8e/

What do I have to add to .GridRole to get this working in all browsers? 我必须添加什么到.GridRole才能在所有浏览器中正常工作? I do not want to add break-all! 我不想添加全部功能!

This scenario can Handle by the two way. 这种情况可以通过两种方式处理。

1) Some charterers after space. 1)一些承租人在太空之后。

2) Use word-wrap:break-all 2)使用word-wrap:break-all

There are two way. 有两种方法。

Solution 1 解决方案1

-ms-word-break: break-all;
       word-break: break-all;

Solution 2 解决方案2

word-break: break-word;
   -webkit-hyphens: auto;
   -moz-hyphens: auto;
   -ms-hyphens: auto;
   hyphens: auto;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM