[英]How do I make this sidebar scrollable?
How do I make this "sidebar" scrollable? 如何使“侧边栏”可滚动? I tried overflow: auto, but that didn't work.
我尝试了溢出:自动,但是没有用。
Correct the line ending for padding, and reduce the height of the sidebar. 校正行尾以进行填充,并减小边栏的高度。
#sidebar {
float:left;
width:330px;
text-align:center;
height:100px;
background:#eee;
padding:150px 5px;
overflow: auto;
}
This will fix it: 这将解决它:
#sidebar {
float:left;
width:330px;
text-align:center;
height:200px;
background:#eee;
padding:150px 5px;
overflow:scroll;
}
First, you were missing a ;
首先,您缺少一个
;
in padding
. 在
padding
。
Second, you should set overflow
to scroll
. 其次,您应该将
overflow
设置为scroll
。
This should work perfectly fine. 这应该工作得很好。 I found a typo in your css.
我在您的CSS中发现了一个错字。 At the end of
在......的最后
padding:150px 5px
the ;
的
;
is missing. 不见了。 Should work with that.
应该可以。
padding:150px 5px;<-- you miss this coma
overflow:auto;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.