开发者

fixed position of inner div related to its container

if have the following code:

<div id="container" style="position:relative; width:300px; height:300px; overflow:scroll;">
    <div id="header">
    </div>
    <div>
    a table of contents
    </div开发者_开发知识库>
</div>

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


Put the header outside of the container. It's useless to let it in since you don't want to display it inside.


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜