Vertically Scrollable In Div Element Using CSS

My computer develop environment

1
2
3
4
5
6
7
$ sw_vers 
ProductName: Mac OS X
ProductVersion: 10.12.6
BuildVersion: 16G29

Chrome
67.0.3396.99(64 bit)

Today I want to share a method that limit div height and view its content by scrolling if content ‘s length is too much for current screen height.

First your should make sure the height you want, and set it in div style

1
<div style="height:100%;">

Next, fixed it being vertical direction in the screen and make it can be scroll.
The core code is overflow-y: scroll;

At last, the complete code is as follow

1
<div style="overflow-y: scroll; height:100%;">
Share