How to make vertically scrollable in CSS

JT Dev - Sep 27 '22 - - Dev Community

In order for the scroll to appear, you need to limit its height by adding height or max-height properties.

.scroll-area {
  overflow-y: auto;
  max-height: 400px;
}
Enter fullscreen mode Exit fullscreen mode

If you do not add this, your block will stretch to the entire height.

Image description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .