原始關閉原因未解決
好的,如果你知道要找什么,你可以發現這個已經討論過了。當代的解決方案是使用一個面具:
.container {
height: 5em;
overflow: auto;
-webkit-mask-image: linear-gradient(to bottom,
transparent .5em,
red 1em calc(100% - 1em),
transparent calc(100% - .5em));
mask-image: linear-gradient(to bottom,
transparent .5em,
red 1em calc(100% - 1em),
transparent calc(100% - .5em));
}
<div class="container">
<div class="content">content is here</div>
<div class="content">content is here</div>
<div class="content">content is here</div>
<div class="content">content is here</div>
<div class="content">content is here</div>
<div class="content">content is here</div>
<div class="content">content is here</div>
<div class="content">content is here</div>
<div class="content">content is here</div>
</div>