overflow shadows with before after

by Pavlo

HTML

<div class="relative-div">
<div class="scrollbox">
<div class="bg-1"></div>
   <div class="bg-2"></div>
   
    <ul>
        <li>Ah! Scroll below!</li>
        <li>2</li>
        
        <li>The end!</li>
        <li>No shadow there.</li>
    </ul>
   </div>
</div>

CSS

.relative-div {
  position: relative;
  border: 1px solid blue;
  width: 200px;
  height: 100px;
}
.scrollbox {
    overflow: auto;
    z-index: 1;
    margin-left:10px;
        margin-right:10px;
}

ul{
  width:500px;
}

.bg-1 {
  position: absolute;
  left: 0px;
     top:0px;
   bottom:0px;
   width: 10px;
  background:white no-repeat;
  
  background-image: radial-gradient(farthest-side at 50% 0, rgba(0,0,0,0.2), rgba(0,0,0,0)), radial-gradient(farthest-side at 50% 100%, rgba(0,0,0,0.2), rgba(0,0,0,0));
    background-position: 0 0, 0 100%;
    background-size: 14px 100%;
    margin-left: -15px;
}

.bg-2 {
     top:0px;
   bottom:0px;
   right: 0px;
  position: absolute;
   width: 10px;
     background:salmon;
         margin-right: -15px;
}

.scrollbox:before,
.scrollbox:after {
    content: "";
    position: absolute;
    top:0px;
   bottom:0px;
    z-index: 1;
    display: block;

    width: 20px;

    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: -20px;
    background: linear-gradient(to left,#FFF,#FFF 30%,rgba(255,255,255,0));
    }
.scrollbox:before {
    left: 0px;  
}
.scrollbox:after {
    right: 0px;
    margin-top: 0px;
    margin-right: -15px;
    margin-bottom: 0px;
    margin-left: 0px;
    background: linear-gradient(to left,rgba(255,255,255,0),#FFF 70%,#FFF);
    }