我有2个DIV,一个是具有dom-repeat的聚合物,它将重复其内部的DOM,但另一个DIV需要固定位置,直到第一个DIV延伸碰撞
<div> Text </div> . // This have DOM-REPEAT
<div class="fix"> </div> . // Need to fix position until get collide
div类“ fix”需要包含原始位置,直到第一个DIV展开并与“ fix”元素碰撞,然后更改为“ relative”
反正有这样做吗? 我已经尝试过边距和填充,但是根本不起作用
答案 0 :(得分:0)
这是我的解决方案,如果您认为有帮助,请投票
.outter {
width: 100px;
min-height: 300px;
background: red;
position: relative;
overflow: auto;
}
.fixed-one {
position: absolute;
bottom: 0px;
width: 100%;
height: 20px;
background-color: blue;
}
<div class="outter">
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div> content content</div>
<div class="fixed-one">
I am fix
</div>
</div>