开发者

Adding Scrollbars in HTML

开发者 https://www.devze.com 2023-02-19 14:49 出处:网络
This is kind of a really nooby question, and I 开发者_开发知识库think I already know the answer, but:

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

精彩评论

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