在 HTML 中添加滚动条 [英] Adding Scrollbars in HTML
本文介绍了在 HTML 中添加滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个非常菜鸟的问题,我想我已经知道答案了,但是:
你能在
的一侧添加滚动条吗?
解决方案
CSS
div {高度:100px;溢出:自动;}
你给出一个明确的高度,这样 div
就不会扩展以适应它的内容.
如果您只想水平或垂直滚动,请分别使用 overflow-x
和 overflow-y
.
如果您希望将额外的内容隐藏,请使用overflow: hidden
.
overflow
属性的默认值是 visible
.
This is kind of a really nooby question, and I think I already know the answer, but:
Can you add Scrollbars to the side of a <div>
?
解决方案
CSS
div {
height: 100px;
overflow: auto;
}
You give an explicit height so the div
doesn't expand to fit its content.
If you only want horizontal or vertical scrolling, use overflow-x
and overflow-y
respectively.
If down the track you want the extra content to be hidden, use overflow: hidden
.
The default for overflow
property is visible
.
这篇关于在 HTML 中添加滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文