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
Record the problems you solve for others. Problem...
How to add <script> script in HTML: 1. You c...
Download and install JDK Step 1: First download t...
Because li is a block-level element and occupies ...
vertical-align attribute is mainly used to change...
Recently I used vue to learn to develop mobile pr...
I am going to review Java these two days, so I wr...
Docker error 1. Check the cause docker logs nexus...
Table of contents 2 solutions for file upload Bas...
We usually use the <ul><li> tags, but ...
Serialization implementation InnoDB implements se...
Table of contents Preface 1. Configure intranet D...
1. Make a repo file Refer to the official install...
Priority The reason why placing the same conditio...
Copy code The code is as follows: <form action...