Rectangle on HTML5 Canvas is stretched?

You need to set a width and height on your canvas element, otherwise this can be the result in some browsers canvas id="canvas" width="400" height="300 And you can not set the canvas size with CSS, this will stretch the canvas.

You need to set a width and height on your canvas element, otherwise this can be the result in some browsers. And you can not set the canvas size with CSS, this will stretch the canvas.

2 That worked thanks. I also had to remove the width and height settings in the CSS for the #canvas. Again thanks, – Mkaveli Aug 2 at 6:40.

The default size of the canvas is 300 x 150. You are probably using these defaults, which will make the rectangle look not square....

I am working on a website and I try to get rectangles on a HTML5 canvas with javascript. Normally this is no problem but now when I make a rectangle with the width and height of 10. It seems that it makes a rectangle with the width of 10 and the height of 20.

The div canvas is set with a width of 100% but I tried to give it a fixed width and that didn't help either.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions