I want to set width 100% and limit it with max-width to my canvas element. Regardless of canvas width I want to have static canvas height.
But when I set it with css, it seems that browser draws canvas with standard siza and rezises canvas to 100% width and proporionaly it resises height. But the worst is that it scales the picture inside the canvas. I also tried to set css width property of canvas from JS but it led to the same result.
<canvas id=myCanvas width=100% height=630px></canvas>
makes canvas with 100px width and 630px height
<canvas id=myCanvas></canvas>
and css
#myCanvas {
width:100%;
height:630px;
}
makes canvas 100% width
but proportionaly resizes height
and scales an image inside canvas.
Setting css with JS does the same.
How am I supposed to do this?