0

var canvas = document.getElementById('canvas')
canvas.width = 200
canvas.height = 200
.container {
  width: 200px;
  height: 200px;
  background-color: green;
  overflow: scroll;
}

#canvas {
  background-color: red;
}
<div class="container">
  <canvas id="canvas"></canvas>
</div>

Container has 200px height, canvas has height 200 and still container is scrollable vertically a little bit. What can I do about it? Where this extra space comes from?

Please note that I don't want to set overflow to hidden, I want it to be set to scroll, I want canvas to fill container without scrollbars appearing.

It's easier to see what is happening on jsfiddle: https://jsfiddle.net/hp8gtudw/6/

enter image description here

user606521
  • 14,486
  • 30
  • 113
  • 204

0 Answers0