简体   繁体   English

IE10不支持空格:预包装?

[英]IE10 doesn't support white-space: pre-wrap?

I have a pre tag in a resizable div . 我在可调整大小的div有一个pre标签。 And the width of pre will stretch or contract when user expands or shrinks the div . 当用户扩展或缩小div时, pre的宽度将拉伸或收缩。 If the text is longer than the pre width, it will be broken into next line. 如果文本长于pre宽度,它将被分成下一行。

I use this CSS for the pre: 我将此CSS用于以下内容:

pre {
 white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
 white-space: -pre-wrap;      /* Opera 4-6 */
 white-space: -o-pre-wrap;    /* Opera 7 */
 word-wrap: break-word;       /* Internet Explorer 5.5+ */
}

This wokrs on FF, Chrome, IE8 and IE9, but not on IE10. 这在FF,Chrome,IE8和IE9上起作用,但在IE10上却不起作用。

On IE10, when user expands it, the text will go the previous line if the width is adequate. 在IE10上,当用户将其展开时,如果宽度足够,则文本将位于前一行。 It works OK. 可以。 But things go bad when user shrinks it. 但是当用户缩小它时,情况会变糟。 The text will be hidden instead of being broken to the next line. 文本将被隐藏,而不是折断到下一行。

I change the white-space: pre-wrap to white-space: pre for IE10, it will break the text. 我将IE10 white-space: pre-wrap更改white-space: pre ,它将破坏文本。 However, the English words will be broken, too. 但是,英语单词也将被破坏。 I want to keep each single word no-wrap. 我想让每个单词都不要换行。

IE10 does support white-space: pre-wrap . IE10确实支持white-space: pre-wrap But IE10 is strict with the width of that element. 但是IE10对该元素的宽度要求严格。

I use a resizable widget for the wapper container, but forget to resize the width of <pre> . 我为wapper容器使用了可调整大小的小部件,但忘记了调整<pre>的宽度。 It will be fixed if I resize/claim the width the <pre> when use expands or shrinks the wrapper <div> . 如果在使用扩展或收缩包装器<div>时调整/声明<pre>的宽度,它将固定。

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

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