与其容器相关的内部div的固定位置 [英] fixed position of inner div related to its container

查看:137
本文介绍了与其容器相关的内部div的固定位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有以下代码:

<div id="container" style="position:relative; width:300px; height:300px; overflow:scroll;">
    <div id="header">
    </div>
    <div>
    a table of contents
    </div>
</div>

当我向下滚动外部div时,如何使内部div与idheader 容器?
TIA
Lina

how do i make the inner div with the id "header" follows when i scroll down the outer div "container"? TIA Lina

推荐答案

我找到了我想做的答案:
http://www.cubido.at/Default.aspx? tabid = 176& EntryID = 8
虽然我认为答案会更简单,但似乎css单独将不能解决它,虽然这将是非常有益的像位置:固定;它不仅相对于页面而且包含元素...

I found the answer to exactly what i want to do here: http://www.cubido.at/Default.aspx?tabid=176&EntryID=8 although i thought the answer is going to be simpler, but seems that css alone won't fix it, although it would be very helpful to have something like "position: fixed;" that works not only relative to page but to containing element...

这篇关于与其容器相关的内部div的固定位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆