我正在尝试制作一个固定位置的侧边栏,它有一个小标题和一个可滚动的 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;
}
谢谢