Javascriptを入手する前にCSSでこれを行う方法があるかどうかを確認するだけです!CSS、動的コンテンツを含む固定位置部門 - その下に別の部門を配置する方法
この例では、#fixed divにはコンテンツが動的に埋められているため、そのdivのコンテンツの大きさは決してわかりません。
#absolute divの先頭は常に#fixed divの下に表示する必要があります。 #absolute divには長時間のコンテンツが動的に埋め込まれるため、ユーザーはそのdivのコンテンツをどれだけ大きくしてもスクロールできる必要があります。
#fixed divのサイズを知らなくても、#fixed divの下の#absolute divの先頭を維持できるCSSのみを使用する方法はありますか?
XHTML:
<div id="right">
<p>This div is just here to force a scrollbar.</p>
</div>
<div id="fixed">
<p>This div gets filled dynamically with content of varying length</p>
</div>
<div id="absolute">
<p>This div also gets filled dynamically with content of varying length,
and needs to stay underneath the div above.</p>
<p>This div will sometimes get so high that it stretches below the bottom of the page,
and because it's inside a fixed positioned div the user won't be able to read all of its content.</p>
</div>
CSS:
#fixed {
position:fixed;
border:2px solid green;
width:200px;
display:block;
background-color:white;
}
#absolute {
position:absolute;
border:2px solid red;
width:200px;
margin-top:90px;
z-index:-1;
}
#right {
position:absolute;
right:0px;
width:200px;
height:4000px;
border:2px solid blue;
}
周り 他のボックスは流れません!あなたの返信ありがとう:) – FrediDoo
問題はありません。 JavaScriptに関する助けが必要ですか? – thirtydot
私はすべていいよ、もう一度ありがとう! – FrediDoo