<!DOCTYPE html>
<html>
  <body>
    <div style="width: 120px; height: 120px; overflow: hidden">
      <canvas width="120" height="120" id="c"></canvas>
    </div>
    <script>
      var ctx = document.getElementById("c").getContext("2d");
      ctx.fillStyle = "green";
      ctx.fillRect(0, 0, 120, 120);
    </script>
  </body>
</html>