2016-10-10 118 views
0

我希望文本可以根据表格宽度进行换行。我的CSS作品无处不在(火狐,Chrome,IE,甚至其它版本),除了IE 10Internet Explorer 10 word break not working

这是HTML代码:

<div class="container"> 
    <table class="table"> 
    <tbody class="tBody"> 
     <tr> 
     <td> 
      <span class="spanClass"> 
      <img src="image.png"> 
       <a href="">This is a verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrryyyyy long 
         text that doesnt work like I want it to. I hate IE. 
       </a> 
      </span> 
     </td> 
     </tr> 
    </tbody> 
    </table> 
</div> 

这是CSS:

.container { 
    white-space: pre-wrap; 
    display: inline-table; 
    word-wrap: break-word; 
    word-break: break-all; 
} 

table { 
    width:100%; 
    table-layout:fixed; 
} 

.spanClass { 
    display: inline-flex; 
} 

伊夫注意到.spanClass规则可能会干扰我想要的内容,但我需要该规则以使<img><a>元素在其他浏览器中正确对齐。

回答

3

您可以使用下面的CSS,而不是你的:

.spanClass { 
    display: inline-block; 
    word-wrap: break-word; 
    word-break: break-all; 
}