我想不出来...
我有一个名为“#ContentContainer”的 div,它的宽度是 100%,它需要一个 nowrap 的空白区域,所以展开和折叠的内部结构将在窗口外冒险并创建一个水平滚动。在展开和折叠的 div 中,我有文本和图像。在 IE 中,这些内部 div 具有 white-space: nowrap 应用于它们...我已将空白设置为正常,但 IE 无法识别...有人可以帮忙吗?
这里是 CSS:
#ContentContainer {
position: relative;
height: 480px;
width: 100%;
margin: 10px 0px 0px 0px;
border: 1px solid blue;
white-space: nowrap;
}
.column {
position: relative;
white-space: normal;
width: 220px;
top: 0px;
border-left: 1px solid #999;
border-right: 1px solid #999;
height: 420px;
margin: 20px 30px 0px 0px;
*display: inline;
vertical-align: top;
}
和我的 HTML:
<div id="#ContentContainer">
<div class="column">
Text that needs to have a white-space or normal. It needs to wrap. Text that needs to have a white-space or normal. It needs to wrap. Text that needs to have a white-space or normal. It needs to wrap.
</div>
<div class="column">
Text that needs to have a white-space or normal. It needs to wrap. Text that needs to have a white-space or normal. It needs to wrap. Text that needs to have a white-space or normal. It needs to wrap.
</div>
<div class="column">
Text that needs to have a white-space or normal. It needs to wrap. Text that needs to have a white-space or normal. It needs to wrap. Text that needs to have a white-space or normal. It needs to wrap.
</div>
</div>
有人吗?
最佳答案
white-space:nowrap
所有版本的 IE 都支持该属性,因此这对您来说应该可以正常工作。
您的问题不是您的 CSS,而是您的 HTML 中的错误:您有 <div id="#ContentContainer">
,但这是不正确的:HTML 代码中的 ID 不应包含哈希符号 ( #
)。在 CSS 代码中需要引用一个 ID,但 ID 本身不应包含它。
所以你的 CSS 是正确的:
#ContentContainer {
....
}
但是您的 HTML 应该如下所示:
<div id="ContentContainer">
....
希望对您有所帮助。
关于internet-explorer - 帮助解决空白 : nowrap and normal in IE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5370165/