css page remove scroll bar method

Step 1: Set the height of the element + overflow: auto;

If you just remove the scrollbar in the vertical direction, you can set overflow-y

PS: Horizontal overflow setting: overflow-x;
when the horizontal and disposal overflow settings are consistent, you can set: overflow

Code example:

A class named 'scroll-box' sets a certain height. If the content in it exceeds the set height, a scroll bar will appear. Scroll up and down to view the complete content:

.scroll-box {
    
    
	height: 200px;
	overflow-y: auto;
}

Step 2: Hide the scroll bar

Sometimes you only need to scroll up and down to view, and you don’t want the scroll bar. How to remove the scroll bar of the element:

.scroll-box::-webkit-scrollbar {
    
    
    display: none;
  }

Image example:

Before going out the scrollbar:

insert image description here

After removing scrollbars:

insert image description here

Guess you like

Origin blog.csdn.net/qq_39111074/article/details/130202935