Here is a div .pagethat is absolutely positioned on this page. Inside there is a div .containerand inside the container there is .contents.
.pagehas a certain landmark, so the contents will scroll inside .page. In this situation, I want the div .stuckto stick to the top .page. (I'm sure I made grammar mistakes above!)
Anyway, fiddel:
http://jsfiddle.net/YBAvb/
update: I want to .stuckbe fixed at the top .pageregardless of the scroll in .page.
this is the layout:
<div class="page">
<div class="container">
<div class="content"></div>
<div class="stuck"></div>
</div>
</div>
and my (not working) css:
.page{
position: absolute;
top:50px;
left:200px;
width:200px;
height:300px;
overflow:auto;
}
.container{
position:relative;
}
.stuck{
position: absolute;
top:0;
right:0;
left:0;
height:50px;
background:blue;
}
.content{
height:700px;
background:gray;
}
, .stuck div .page div. ?
:
: , .stuck be positions:fixed .page, , .page JS .