JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div id="container">
<canvas id="inner" height=300 width=300>
</canvas>
</div>
</body>
CSS
#container {
width: 100px;
height: 100px;
background: #fff;
}
#inner {
width: 300px;
height: 300px;
margin: 0;
padding: 10px;
overflow-x: scroll;
overflow-y: hidden;
background: #ccc;
}
JavaScript
var canvas = document.getElementById('inner')
var ctx = canvas.getContext('2d')
ctx.fillText('Hello World', 50, 50)