Вы должны добавить несколько -webkit-scrollbar
селекторов в css к , чтобы показывать полосу прокрутки каждый раз. Посмотрите на пример ниже:
.scrollable-content::-webkit-scrollbar {
-webkit-appearance: none;
}
.scrollable-content::-webkit-scrollbar:horizontal {
height: 11px;
}
.scrollable-content::-webkit-scrollbar-thumb {
border-radius: 8px;
border: 2px solid white;
background-color: rgba(0, 0, 0, .5);
}
.scrollable-content::-webkit-scrollbar-track {
background-color: #fff;
border-radius: 8px;
}
.container {
overflow-y: auto;
overflow-x: hidden;
}
.content {
background-color: lightblue;
height: 5rem;
}
.scrollable-content {
background-color: lightgreen;
height: 30vh;
overflow-x: auto;
width: 100%;
}
.wide-content {
width: 150vw;
}
<div class="container">
<div class="content">
Div which is not horizontally scrollable
</div>
<div class="scrollable-content" style="width:500px; overflow-x:scroll; border:dotted 1px; white-space: nowrap;padding-bottom:10px;">
Div which is horizontally scrollable
<div class="wide-content">
Some wide content
</div>
</div>
</div>
Надеюсь, решение будет таким, как вы его себе представляли