JSFiddle - React, Tailwind, and code Playground

by huuzoo

HTML

<button onclick="moveScroll();">移動</button>
<div id="target">
  <div id="sample">
    <p>あいうえお。カキクケコ。さしすせそ。タチツテト<br></p>
  </div>
</div>

CSS

#target {
  overflow: scroll; 
  width: 100px;
  height: 100px;
}
#sample {
  width: 500px;
  height: 100px;
  background-color: yellow;
}

JavaScript

function moveScroll(){
	var target = document.getElementById('target');
	target.scrollLeft += 50;
}