Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 文本未在div中换行,宽度在IE7以内_Html_Css_Internet Explorer 7 - Fatal编程技术网

Html 文本未在div中换行,宽度在IE7以内

Html 文本未在div中换行,宽度在IE7以内,html,css,internet-explorer-7,Html,Css,Internet Explorer 7,在IE7中,宽度小于文本的div中的文本不会换行为两行。与IE7相比,它在其他浏览器上工作得更好 <div class="office-header-info"> <div class="local-office">District of Columbia</div> </div> 在IE7中,哥伦比亚特区保持在一条线上,而在其他浏览器中则保持在一条线上 哥伦比亚特区 这就是它应该是的,所以IE7对于像哥伦比亚特区这样的一条线是不正确的。如果我添

在IE7中,宽度小于文本的div中的文本不会换行为两行。与IE7相比,它在其他浏览器上工作得更好

<div class="office-header-info">
<div class="local-office">District of Columbia</div>
</div>
在IE7中,哥伦比亚特区保持在一条线上,而在其他浏览器中则保持在一条线上

哥伦比亚特区

这就是它应该是的,所以IE7对于像哥伦比亚特区这样的一条线是不正确的。如果我添加溢出:隐藏,它将被切断

这能解释为什么在IE7中文本不会换行成两行吗

white-space: pre; /* CSS 2.0 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3.0 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -moz-pre-wrap; /* Mozilla */
white-space: -hp-pre-wrap; /* HP Printers */
word-wrap: break-word; /* IE 5+ */

试一试。

试试浮动
。本地办公室也可以。
这有一些有用的提示:您尝试过自动溢出吗?刚刚在最新的Chrome、IE6、IE7中尝试过:三种浏览器的结果都相同。这些建议都不管用,但是jsfiddle.net链接给了我一个主意,让我继续添加div和样式,直到它崩溃。他把这称为IE7的问题,而你却给了他一个解决方案,涵盖Opera、Mozilla和HP打印机?@animuson是的,我是。以防万一,他想要更多地控制他的div和包装方式。