Mobile Mobile pages only need to be compatible with Chrome and Safari, so you can use the custom scroll bar pseudo-class selector ::-webkit-scrollbar to hide the scroll bar. .container::-webkit-scrollbar { display: none; } PC The compatibility requirements of the PC side are relatively higher, so you can try another method. The general idea is to wrap a parent container div outside the content div, set overflow: hidden, set display-x: hidden; display-y: auto for the content div; finally, set the width of the parent container div to be smaller than the width of the content div or set the margin-right of the content div to a negative value. <div class="outer"> <div class="content"> <p>1111</p> <p>222</p> <p>333</p> <p>444</p> </div> </div> .outer { width: 300px; height: 300px; overflow: hidden; .content { width: 330px; /*margin-right: -15px;*/ height: 100%; overflow-x:hidden; overflow-y: auto; background: red; padding-top: 100px; p:not(:first-child) { margin-top: 100px; } } } Summarize The above is the pure CSS that I introduced to you to hide the scroll bar but still have the scrolling effect (mobile and PC). I hope it will be helpful to you! |
<<: Add ico mirror code to html (favicon.ico is placed in the root directory)
>>: Detailed tutorial on deploying Apollo custom environment with docker-compose
Table of contents 1. Sorting function 2. Prepare ...
Introduction to sudo authority delegation su swit...
This article shares the specific code of JS to im...
Kernel: [root@opop ~]# cat /etc/centos-release Ce...
Preface This article introduces how to use the ne...
Introduction to Swap Swap (i.e. swap partition) i...
Table of contents 1. Offline installation 2. Onli...
There are many import methods on the Internet, an...
This article example shares the specific code of ...
Table of contents 1. Quickly recognize the concep...
Using SSH terminal (such as putty, xshell) to con...
Easy installation of opencv2: conda install --cha...
I've been writing a WeChat applet recently an...
Many people use Linux Homebrew. Here are three ti...
Table of contents Product Requirements Ideas Prob...