大多数情况下我们为了页面完美展示,都会把滚动条隐藏,但是某些小展示区域,文字超过了展示区域,为了引起用户注意,告诉用户还有更多信息需要滚动查看,需要强制显示滚动条。
在移动端,我们可以使用以下css代码,给特定DOM元素增加滚动条。
.scrollDomStyle{ overflow-y: scroll !important; /* debug ios 默认不显示滚动条 */ -webkit-overflow-scrolling: auto !important;}.scrollDomStyle::-webkit-scrollbar{ -webkit-appearance: none; width: 4px;}.scrollDomStyle::-webkit-scrollbar-thumb{ border-radius: 4px; background-color: #d8d8d8;}