CSS3 changes the browser scroll bar style

CSS3 changes the browser scroll bar style

Note: This method is only applicable to webkit-based browsers.

The browser scroll bar is too wide and ugly, which affects daily development. What should I do?

The appearance of the scroll bar consists of two parts: 1. The overall slide of the scroll bar 2. The slider inside the scroll bar slide

In CSS, the scroll bar consists of 3 parts

name::-webkit-scrollbar //Overall scrollbar stylename::-webkit-scrollbar-track //Scrollbar trackname::-webkit-scrollbar-thumb //Scrollbar internal slider

Note: The above three are all pseudo-classes. Please change name to the element name you want to change.

For example: change the scroll bar style of the entire page

body::-webkit-scrollbar{ //First change the scroll bar width of body: 8px;

}

body::-webkit-scrollbar-track{//Change the scroll bar track color of the body background: rgb(200, 200, 200);

border-radius: 5px;

}

body::-webkit-scrollbar-thumb{//Finally, change the style of the body's scroll bar slide background: rgb(120, 120, 120);

border-radius: 5px;

}

◆ The right side shows the scroll bar style after the upper code is changed

◆ You can add background, transparency, border, rounded corners and other attributes to the style to make the browser more beautiful

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

<<:  Several ways to encrypt and decrypt MySQL (summary)

>>:  Tutorial on deploying springboot package in linux environment using docker

Recommend

How to install WSL2 Ubuntu20.04 on Windows 10 and set up the docker environment

Enable WSL Make sure the system is Windows 10 200...

A record of a Linux server intrusion emergency response (summary)

Recently, we received a request for help from a c...

Detailed explanation of Truncate usage in MySQL

Preface: When we want to clear a table, we often ...

Research on the problem of flip navigation with tilted mouse

In this article, we will analyze the production of...

JavaScript macrotasks and microtasks

Macrotasks and Microtasks JavaScript is a single-...

Detailed explanation of basic management of KVM virtualization in CentOS7

1. Install kvm virtualization : : : : : : : : : :...

Node.js uses express-fileupload middleware to upload files

Table of contents Initialize the project Writing ...

How to set process.env.NODE_ENV production environment mode

Before I start, let me emphasize that process.env...

This article will help you understand JavaScript variables and data types

Table of contents Preface: Kind tips: variable 1....

Javascript scope and closure details

Table of contents 1. Scope 2. Scope Chain 3. Lexi...

HTML Several Special Dividing Line Effects

1. Basic lines 2. Special effects (the effects ar...

Method example of safely getting deep objects of Object in Js

Table of contents Preface text parameter example ...