こちら にもコードを載せているのですが、以下contentを親のouterに対してfixedにしたいです。
現状下にスクロールするとそれに合わせてスクロールされてしまいますが親の位置で固定したいという感じです。position fixedでなくても希望の動作になるのであればそれでも良いのですが何か良い方法ご存知の方、ご教示いただけますと大変助かります。
css
1.outer { 2 position: relative; 3 background: green; 4 width: 1000px; 5 height: 300px; 6 overflow: scroll; 7} 8 9.content { 10 position: absolute; 11 background: rgba(0, 0, 255, 0.428); 12 width: 100%; 13 height: 100%; 14 top: 0%; 15} 16 17.content2 { 18 background: pink; 19 width: 100%; 20 height: 1000px; 21 top: 0%; 22}
html
1<div class="outer"> 2 <div class="content"></div> 3 <div class="content2"> test</div> 4</div>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。