html - 我想改变水平滚动条css
问题描述
我想更改水平滚动条 css。在这里我使用代码来改变它,但它也改变了我的垂直滚动条,我只想改变水平滚动条。怎么做?在这里我也上传图片。
::-webkit-scrollbar {
width: 5px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #888;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
解决方案
尝试这个
div {
width: 400px;
overflow-x: auto;
white-space: nowrap;
}
div::-webkit-scrollbar {
width: 1em;
}
div::-webkit-scrollbar-track {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}
div::-webkit-scrollbar-thumb {
border-radius: 10px;
background-color: #00bd86;
outline: 2px solid slategrey;
}
div::-webkit-scrollbar:vertical {
display: none;
}
<div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries, but also the leap into</div>
推荐阅读
- javascript - 如何使用返回的承诺来运行控制台消息
- delphi - FireMonkey:如何在所有表单运行时更改 styleBook 的样式?
- java - 使用 JNDI 将任何数据(条目)添加到 LDAP 服务器
- python - 如何将 Apache Airflow Python 路径从 Python 2.7 更改为 3?
- javascript - div颜色更改jquery单击按钮
- angular - Angular 不会从流( StreamingResponseBody )中下载文件
- powershell - 使用 if 语句在 While 循环中读取主机
- python - jupyter kernet 自动停止
- spring-batch - 如何使用 Spring Batch 进行聚合?
- android - Android 应用程序在调试中工作,但在发布时不工作