简体   繁体   English

自动换行:100%表格单元中的断行

[英]word-wrap:break-word in 100% table-cell

JSFiddle: http://jsfiddle.net/nw4dF/ JSFiddle: http : //jsfiddle.net/nw4dF/
So, why in my table-cell #c, the css rule word-wrap:break-word is ignored and cause the elongation of the table in case of overflow? 那么,为什么在我的表格单元#c中,css规则word-wrap:break-word被忽略,并在溢出的情况下导致表格伸长? I don't want use word-break: break-all; 我不想使用word-break: break-all; , how to solve? , 怎么解决?

Use word-break instead of word-wrap for webkit + opera and hypehns for moz and IE10+ (you need a lang attribute declared). 对于Webkit + Opera,请使用word-break而不是word-wrap对于hypehns和IE10 +,请使用hypehns (需要声明lang属性)。 For earlier versions of IE you'll just have to use word-break: break-all . 对于早期版本的IE,您只需使用word-break: break-all

JSFiddle 的jsfiddle

HTML HTML

<div id="a" lang="en">
    ...
</div>

CSS CSS

#c {
    *word-break: break-all;
     word-break: break-word;

    -moz-hyphens: auto;
     -ms-hyphens: auto;
         hyphens: auto;
}

try this - jsfiddle.net/nw4dF/1/ 试试这个-jsfiddle.net/nw4dF/1/

or you could change table syntax on div or something more flexible 或者您可以更改div上的表语法或更灵活的方法

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

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