V
V
vasIvas2015-01-30 17:45:02
JavaScript
vasIvas, 2015-01-30 17:45:02

What's wrong with canvas?

Here is the code and picture of the canvas sized 100x100 -
5f348185a1834104911b40b56790f646.png
But with the size 200x200 -
f74823c5616146448ba809ff51b5ef7f.png
Why is it somehow elongated, what does it have in all browsers?
Here is the clean code -

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Canvas</title>
  <script type="text/javascript">
    document.addEventListener( 'DOMContentLoaded', document_domContentLoadedHandler );

    function document_domContentLoadedHandler( ){
      var canvas = document.getElementById( 'canvas' );
      var context = canvas.getContext( '2d' );

      context.fillStyle = "green";
      context.fillRect(10, 10, 100, 100);
    }
  </script>
</head>
<body>
  <canvas id="canvas"></canvas>
</body>
</html>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question