CodePen

HTML

            
              <div class="one">
  <div>
    
  </div>
  
  <div>
    
  </div>
 </div>

<div class="two">
  <div>
    
  </div>
  
  <div>
    
  </div>
 </div>
            
          
!

↑ Insert the most common viewport meta tag

CSS

            
              div.one {
  width: 300px;
  height: 200px;
  
  overflow-y: scroll;
}

div.one div:first-child {
  background-color: red;
  display: inline-block;
  width: 300px;
  height: 200px;
}

div.one div:last-child {
  background-color: blue;
  display: inline-block;
  width: 300px;
  height: 200px;
}

div.two {
  width: 300px;
  height: 200px;
  position: absolute;
  overflow-y: scroll;
}

div.two div:first-child {
  background-color: red;
  position: absolute;
  width: 300px;
  height: 200px;
}

div.two div:last-child {
  background-color: blue;
  position: absolute;
  width: 300px;
  height: 200px;
  left: 300px;
}
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
              
            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................