开发者

Adding Scrollbars in HTML

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;
}

jsFiddle.

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.


Css:

overflow:auto;

or force the scroll area even when content doesn't overflow by:

overflow-y:scroll;


This will add scroll bar in a div

 <div style="overflow:auto; height:556px;width:564px;">
 </div> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜