css 空白 :nowrap horizontal scroll bug

标签 css whitespace horizontal-scrolling nowrap

我有以下标记

<style type="text/css">
    #outer
    {
        min-height: 100%;
        height: auto !important;
        height: 100%;
        width:100%;
        white-space:nowrap;
    }

    #inner
    {
        background-color:#CCCCCC;
        margin:0px 4px 0px 4px;
        padding:5px 5px 0px 5px;
        border:1px solid #9A9A9A;
        border-width:1px 1px 0px 1px;
    }

</style>

<div id="outer">
    <div id="inner">
    TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST
    </div>
</div>

当浏览器足够宽时,它看起来像这样 wide

当浏览缩小时,它看起来像这样 narrow

我希望窄 View 的灰色背景在滚动时一直向右延伸。我的标记和 css 导致了这种不良影响(发生在 Chrome、FF3 和 IE8 中)

最佳答案

一个简单的解决方案是:在 #outer 上,删除 width: 100% 并添加 float: left

Live Demo

关于css 空白 :nowrap horizontal scroll bug,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4964041/

相关文章:

jquery - 为什么我的水平滚动网站会丢失导航栏?

javascript - 使用查询的水平图像滚动

android - 在 Android 中实现水平日期选择器

html - 将输入字段左对齐

javascript - 跨浏览器鼠标滚轮,通过一个滚轮滚动 100% 浏览器高度

html - CSS:垂直对齐文本?

whitespace - Bxslider 不需要的顶部和底部空白

html - 为什么它优先

C++//将getline输入与多字串进行比较?

css - 我怎样才能去掉页面顶部/底部的白色间距?