次のコンテンツを含む HTML ページがあります -
<div class="sidebar">
Some content here....
</div>
<div class="content">
content here too...
</div>
.sidebar を にしたいのですがposition:fixed
、.content はそうではありません。これが私がCSSで試したことです-
*{box-sizing:border-box;}
.sidebar{
background:rgb(24, 33, 61);
text-align: right;
height: 100% !important;
width:30%;
postion:fixed;
left:0px;
top:0px;
bottom:0;
padding:1em;
color:white;
}
.content{
width:70%;
font-size:1.1em;
font-weight:normal;
position: absolute;
top:0;
right:0;
padding:2em;
}
基本的にはこれを再現したい。しかし、私が今得ているものは一見完璧に見えますが、下にスクロールすると、.sidebar は移動せず、同じ場所にとどまります。
コードペンのデモンストレーション
どうすればそれを機能させることができますか?