internet-explorer - 帮助解决空白 : nowrap and normal in IE

标签 internet-explorer whitespace

我想不出来...

我有一个名为“#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/

相关文章:

html - CSS跨浏览器图像对齐问题

python - 为什么请求 HTML 页面会使我的本地 Google App Engine 服务器崩溃?

javascript - Internet Explorer 何时在 JavaScript 中添加了对 for..in 循环的支持?

c# - 用于保留空格的 XAML 等效代码是什么?

php - 在 PHP 中过滤所有类型的空格

html - 日文 unicode 字符正在反转 CSS 向左浮动

javascript - 检查 javascript 是否加载了 es5-shim.js?那是为了ie8

javascript - meteor 辅助变量去除重复的相邻空格

html - 网站顶部的空白

mysql - 合并具有不同ID但相同数据的MySQL行