CSS 自动换行在 Internet Explorer 中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16098785/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Word-wrap not working in Internet Explorer
提问by dShringi
When I'm using word-wrap:break-word
with Browser Mode: IE9 Compatibility View and Document Mode: IE7 standardsits working perfectly fine. However when I change the Document Mode: IE9 standards, its not working.
I've also tried using -ms-word-wrap:break-word
however its giving me the same result.
当我使用word-wrap:break-word
与浏览器模式:IE9兼容性视图和文档模式:IE7标准其工作完全正常。但是,当我更改Document Mode: IE9 Standards 时,它不起作用。我也尝试过使用,-ms-word-wrap:break-word
但是它给了我相同的结果。
Document Type Definition: DTD/xhtml1-transitional.dtd
文档类型定义:DTD/xhtml1-transitional.dtd
Can anyone tell me why is it so and if there is any workaround to cope up with it ?
谁能告诉我为什么会这样,是否有任何解决方法来应对?
回答by btevfik
you need to have
你需要有
table {
width:100%;
table-layout:fixed;
}
and put word-wrap
in table,td,th
not into span
并提出word-wrap
在table,td,th
不进span
回答by mukesh
applying word-wrap property to parent of the concerned element will resolved the problem in IE9.
将自动换行属性应用于相关元素的父元素将解决 IE9 中的问题。
回答by Piyush Marvaniya
try it this way
试试这个方法
.table tr td {
word-wrap: break-word;
word-break: break-all;
}
回答by DevOragz
In my case, IE did not respect the word break style until I made the span render as inline-block.
就我而言,IE 不尊重分词样式,直到我将跨度呈现为内联块。
.selector{
display: inline-block;
word-break: break-all;
overflow-wrap: break-word; /* For other browsers*/
}
回答by Anusha Medicherla
-ms-word-break: break-all;
works in > IE9
适用于 > IE9
回答by frodo2975
Adding -ms-word-break: break-word;
worked for me.
添加-ms-word-break: break-word;
对我有用。
回答by Jurijs Nesterovs
it should work, .your_class_name{word-break:break-word;}
, i have tested it in ie7 - ie9 and it breaks the word...
它应该可以工作,.your_class_name{word-break:break-word;}
我已经在 ie7 - ie9 中对其进行了测试,但它打破了这个词......