0

why textAlign no infulence below?

<html> <head></head> <body> <canvas id="canvas1" width="400" height="400"> </canvas> <script> var canvas = document.getElementById('canvas1'); ctx =canvas.getContext('2d'); ctx.font="bold 22px Tahoma"; ctx.fillText("start", 10, 30); ctx.translate(100, 150); ctx.scale(1.5, 4); ctx.fillText("after scale", 0,20); </script> </body> </html> the same it appears or not?

21st Sep 2017, 12:22 PM
William
1 Réponse
+ 12
Text align is used to align text not canvas or other block level elements. use margin, padding along with position to do that. https://developer.mozilla.org/en-US/docs/Web/CSS/text-align text-align https://code.sololearn.com/Wt8UuZ3kP0Q4/?ref=app text-align demo
21st Sep 2017, 1:12 PM
Lord Krishna
Lord Krishna - avatar