css3 - canvas is not displaying properly in IE10 with max-width:100% -


css:

canvas {     max-width: 100%;     } 

html:

<canvas id="spades" width="240" height="320" style="background-color:white;border-radius:10px"> 

the above css not working in ie10, height replaced width supply. appricited

are trying resize canvas full page size?

your max-width used define theoretical maximum width of canvas, not cause canvas resized.

anyway...

don't use css resize canvas because canvas drawings distorted. that's because browser responds css canvas resizing "stretching" existing canvas pixels.

instead, resize in javascript setting width of canvas element itself.

var canvas = document.getelementbyid('mycanvas'), canvas.width = window.innerwidth; canvas.height = window.innerheight; 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -