我有一个div(.outer
- 视口),其固定高度包含应该可滚动的另一个div(.inner
- 内容)。 .inner
div与bottom: 0
绝对定位,这样我们总能看到这个div底部的内容。滚动具有绝对位置的内容
问题是,当此bottom: 0
被添加到.inner
时,.outer
的滚动条变成灰色并且不活动。如果我们删除bottom: 0
,则滚动条有效,但我们看到.inner
的顶部,而不是底部。
这是HTML:
<div class="outer">
<div class="inner">
this content should be scolled to the bottom possibly with bottom: 0; AND we should still have to scrollbar the scroll to the top<br/>
1<br/>
2<br/>
3<br/>
4<br/>
5<br/>
6<br/>
7<br/>
8<br/>
9<br/>
10<br/>
11<br/>
12<br/>
13<br/>
14<br/>
15<br/>
16<br/>
17<br/>
18<br/>
19<br/>
20<br/>
bottom (the scrollbar must be active)
</div>
</div>
CSS:
.outer {
height: 200px;
position: relative;
overflow-y: scroll;
width:270px;
}
.inner {
position: absolute;
bottom: 0px;
background-color:#aaa;
width:250px;
}
使用jQuery显示在.outer的视口.inner的底部也是可以接受的。
这工作令人愉快。 :)你无法想象我多么感激。 – isHristov 2012-02-19 09:43:26