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

Analysis of several reasons why Iframe should be used less

The following graph shows how time-consuming it is...

MySql 8.0.11 installation and configuration tutorial

Official website address: https://dev.mysql.com/d...

JavaScript to implement voice queuing system

Table of contents introduce Key Features Effect d...

Mini Program to Implement Paging Effect

This article example shares the specific code for...

This article will help you understand the life cycle in Vue

Table of contents 1. beforeCreate & created 2...

Setting the engine MyISAM/InnoDB when creating a data table in MySQL

When I configured mysql, I set the default storag...

Understand the principle of page replacement algorithm through code examples

Page replacement algorithm: The essence is to mak...

MySQL primary key naming strategy related

Recently, when I was sorting out the details of d...

Detailed explanation of the execution order of JavaScript Alert function

Table of contents question analyze solve Replace ...

Add and delete table information using javascript

Getting Started with JavaScript JavaScript is a l...

Explain how to analyze SQL efficiency

The Explain command is the first recommended comm...

Detailed explanation of Linux text processing command sort

sort Sort the contents of a text file Usage: sort...

Detailed explanation of the use of MySQL DML statements

Preface: In the previous article, we mainly intro...