css add scroll to div and hide the scroll bar

css add scroll to div and hide the scroll bar

CSS adds scrolling to div and hides the scroll bar. The specific code is as follows:

In html

<div class="box">
    <div>The following content will scroll separately</div>
    <div class="scroll">
        <div class="content">
            <p>1111111111111111</p>
            <p>22222222222222</p>
            <p>333333333333333</p>
            <p>444444444444444</p>
            <p>1111111111111111</p>
            <p>22222222222222</p>
            <p>333333333333333</p>
            <p>444444444444444</p>
        </div>
    </div>
</div>

CSS part

<style>
    div{
        font-size: 15px;
        margin-bottom: 20px;
    }
    .content{
        height: 300px;v // The height of the scrolling part must be set background-color: cadetblue;
        color: antiquewhite;
        overflow-x: hidden; /*x-axis scrolling is prohibited*/
            overflow-y: scroll;/*y-axis scroll*/ 
    }
    .content::-webkit-scrollbar {
        display: none;/*Hide scroll bar*/ 
    }
    p{
        margin-bottom: 30px;
        font-size: 17px;
        color: #333;
    }
</style>

Summarize

The above is the CSS that I introduced to you to add scrolling to div and hide the scroll bar. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

<<:  An IE crash bug

>>:  Common functions of MySQL basics

Recommend

JavaScript functional programming basics

Table of contents 1. Introduction 2. What is func...

MySQL query redundant indexes and unused index operations

MySQL 5.7 and above versions provide direct query...

Django+mysql configuration and simple operation database example code

Step 1: Download the mysql driver cmd enters the ...

VUE introduces the implementation of using G2 charts

Table of contents About G2 Chart use Complete cod...

9 super practical CSS tips to help designers and developers

A web designer's head must be filled with a lo...

A brief discussion on mobile terminal adaptation

Preface The writing of front-end code can never e...

A brief discussion on Yahoo's 35 rules for front-end optimization

Abstract: Whether at work or in an interview, opt...

CentOS 6 Compile and install ZLMediaKit analysis

Install ZLMediaKit on centos6 The author of ZLMed...

MySQL query sorting and paging related

Overview It is usually not what we want to presen...

mysql wildcard (sql advanced filtering)

Table of contents First, let's briefly introd...

A brief analysis of the differences between px, rem, em, vh, and vw in CSS

Absolute length px px is the pixel value, which i...

Example of how to achieve ceiling effect using WeChat applet

Table of contents 1. Implementation 2. Problems 3...

Pure CSS implementation of radio and checkbox effect example

radio-and-checkbox Pure CSS to achieve radio and ...

Summary of Mysql common benchmark commands

mysqlslap Common parameter description –auto-gene...