У меня есть потенциальное решение, но мне нужно было поместить переполнение на <ul>
, переместить «крышку» после <ul>
и также сделать контейнер display: flex
. «Крышка» тогда просто относительно позиционируется назад над <ul>
.
Я также добавил background-color
, чтобы лучше показать "обложку" для демо.
ul {
padding: 0;
list-style: none;
display: flex;
justify-content: space-between;
flex-wrap: nowrap;
position: relative;
width: 100%;
overflow-y: hidden;
overflow-x: scroll;
}
li {
display: inline-block;
flex: 0 0 24%;
max-width: 24%;
margin-right: 1.3%;
margin-top: 3px;
height: 140px;
color: #000000;
white-space: normal;
text-align: left;
}
.container {
white-space: nowrap;
background: #fff;
height: 180px;
background-color: white;
display: flex;
}
.cover {
content: '';
position: relative;
left: -20px;
width: 20px;
height: 150px;
background-color: tomato;
}
.box {
border: 1px solid #000;
}
<div class="container">
<ul>
<li class="box empty"></li>
<li class="box gradient"></li>
<li class="box gradient"></li>
<li class="box gradient"></li>
<li class="box gradient"></li>
</ul>
<div class="cover"></div>
</div>