【发布时间】:2013-03-15 23:02:36
【问题描述】:
小提琴:http://jsfiddle.net/EzuTT/
CSS
#bottomfadebar {
position:fixed;
z-index: 2;
bottom: 0px;
width:267px;
height:84px;
background-color:#666;
}
#content{
width:2000px;
background-color:#ccc;
}
HTML
<div id="content">
This is all of the data. Theres lots of it. so the user will have to scroll horizontally. the bottom bar should go out of view as you scroll further to the right because there's so much data. the bottom bar should only stay "fixed" to the bottom, not to the left hand corner.
</div>
<div id="bottomfadebar">
THIS SHOULD SCROLL HORIZONALLY AS THE PAGE DOES
</div>
最终,当您向右滚动以查看更多内容 div 时,#bottomfadebar div 将继续停留在左下角。我试图弄清楚如何让bottomfadebar DIV滚动到屏幕左侧,但仍然像当前一样固定在窗口底部。
-----编辑!!!
好的,所以我有点夸大其词,因为我认为它很容易解释,但后来我意识到绝对因素会出现。它实际上应该位于居中的 NAV div 内。
它确实需要在“容器”区域内保持绝对左侧:0....我应该指定的,我很抱歉。不知道该怎么做。
【问题讨论】:
-
使用
position:absolute? -
用
absolute代替fixed怎么样 -
好的,所以我有点夸大其词,因为我认为它很容易解释,但后来我意识到绝对因素会出现。它实际上应该位于居中的 NAV div 内。 jsfiddle.net/u5GuG/4 它确实需要坚持“容器”区域内的绝对左侧:0....我应该指定,我很抱歉。不知道该怎么做。
-
看看这个:jsfiddle.net/DS6yg/1。注意页面加载时,一切都很好地居中,400 px,页脚粘在底部。现在使用您的 jfiddle 窗口并使输出窗口更小,以便获得水平滚动条。如果向右滚动,您会看到页眉和内容按原样滚动离开页面,页脚不会水平滚动离开页面。我只是想让页脚滚动与页眉和内容保持一致。很抱歉没有很好地解释这一点!