当前位置:网站首页>Modify scroll bar style
Modify scroll bar style
2022-07-19 07:49:00 【guizi0809】
Conditions for the appearance of scroll bars
- The parent element has a fixed width and height ( Or set up
max-height,max-width) - The child element exceeds the fixed width and height of the parent element , Or exceed the maximum width set by the parent element / Maximum height
- Parent element Settings
overflow: auto
notes :overflow: auto It's actually overflow-x: auto and overflow-y: auto Short form of
But for x Axis Scroll bar and y Axis The scroll bar display is set separately
| Parameters | describe |
|---|---|
| auto | When the width or height is not exceeded, the scroll bar is not displayed , The scroll bar is automatically displayed when the width or height is exceeded |
| hidden | Whether or not it exceeds the width or height , Don't show scroll bar ( Hide scroll bar ) |
| scroll | Whether or not it exceeds the width or height , The scroll bar must be displayed |

Change the scroll bar style
The default scroll bar style is a little ugly , have access to css Set the style of the scroll bar ( The scroll bar is on the parent element ), The scrollbar pseudo elements that can be set are as follows :
| Scroll bar pseudo element | describe |
|---|---|
| ::-webkit-scrollbar | The whole scroll bar |
| ::-webkit-scrollbar-thumb | The scroll slider on the scroll bar |
| ::-webkit-scrollbar-track | Scroll bar track |
| ::-webkit-scrollbar-track-piece | The track part of a scroll bar without a slider |
| ::-webkit-scrollbar-button | The buttons on the scroll bar ( Up and down arrow ) |
| ::-webkit-scrollbar-corner | When there are both vertical and horizontal scrollbars, the intersection part |
| ::-webkit-resizer | Of certain elements corner Part style of part ( example :textarea Drag button for ) |
| ::-webkit-scrollbar-button:horizontal:single-button:start | Left button of horizontal scroll bar |
| ::-webkit-scrollbar-button:horizontal:single-button:end | Horizontal scroll bar right button |
| ::-webkit-scrollbar-button:vertical:single-button:start | Buttons on the vertical scroll bar |
| ::-webkit-scrollbar-button:vertical:single-button:end | The button below the vertical scroll bar |
A simple example :
/*outer-box Parent element */
/* Scroll bar overall style This is the case Y Axis roll , Set width , When it comes to X When the axis rolls , Then set the height */
.outer-box::-webkit-scrollbar {
width: 8px;
}
/* The slider in the scroll bar */
.outer-box::-webkit-scrollbar-thumb {
border-radius: 2px;
background: #d5d5d5;
}
/* Scroll bar track */
.outer-box::-webkit-scrollbar-track {
border-radius: 2px;
background: #f1f1f1;
}

In general use ::-webkit-scrollbar、::-webkit-scrollbar-thumb and ::-webkit-scrollbar-track These three pseudo elements can be set
::-webkit-scrollbar This pseudo element must be written , Otherwise, you cannot modify the default style
边栏推荐
- VMware cloud director 10.4 release (including download) - cloud computing provisioning and management platform
- Spark3.x entry to mastery - stage 7 (spark dynamic resource allocation)
- CAN FD如何应用Vector诊断工具链?
- 正则表达示提取匹配内容
- Pytorch随记(2)
- 预测销售XGBoost
- Flink入门到实战-阶段二(图解运行时架构)
- Slackware 14.2 installing KDE 5 plasma
- [operation rules] how to realize TSN system level test?
- AB Testing Review
猜你喜欢

CAN FD如何应用Vector诊断工具链?

Spark3.x entry to mastery - stage 7 (spark dynamic resource allocation)

Use Altium designer software to draw a design based on stm32

Notepad++ underline and case letter replacement

pytorch随记(5)

Spark3.x-实战之双流join(窗口和redis实现方式和模板代码)

fiddler 抓包工具使用

修改select样式

Flink entry to actual combat - phase III (datastream API)

@How can conditionalonmissingbean cover beans in third-party components
随机推荐
Pytorch随记(2)
Flink entry to practice - phase I (cluster installation & use)
Redis 详解
Introduction to arm development environment
正则表达示提取匹配内容
flowable 查询、完成、作废、删除 任务
How to choose flash for new products?
The best storage scheme of MCU CS Chuangshi SD NAND
Spark入门到精通-番外篇(Standaone集群的运维和简单操作)
Flink introduction to practice - phase II (illustrated runtime architecture)
传递多图片,是空情况的判断。
How does Jenkins set the mailbox to automatically send mail?
HMI概念设计的未来在哪里?
Administrator blocked this app from running
Question 114 of Li Kou: binary tree expansion linked list
Use Altium designer software to draw a design based on stm32
Typescript (I)
OpenSUSE install Netease cloud music (tumblefeed) (LEAP)
FMC sub card: 4-channel 250msps sampling rate 16 bit AD acquisition sub card
Prevent blackmail attacks through data encryption schemes