Adding Scrollbars in HTML

23,566

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.

Share:
23,566
Admin
Author by

Admin

Updated on June 01, 2020

Comments

  • Admin
    Admin almost 4 years

    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>?