小さなヘッダーとその下にスクロール可能な div がある固定位置のサイドバーを作成しようとしています。
私の問題は、div 全体をスクロールできないため、その中のすべてが表示されないことです。
これが私のコードで、ここでは jsfiddle にあります。
HTML
<section>
<header>we have some text here
<br>a few lines
<br>doesn't matter
<br>
</header>
<div class="scroll-box">FIRST LINE
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>LAST LINE
<br>
</div>
CSS
section {
position: fixed;
top:0;
left: 0;
height: 100%;
width: 300px;
background: red;
}
.scroll-box {
overflow: scroll;
height: 100%;
width: 100%;
background: #eee;
}
ありがとう