HTML5 Canvas Text Align Tutorial

To align HTML5 Canvas text, we can use the textAlign property of the canvas context, which can be set to startendleftcenter, or right. The alignment is relative to an imaginary vertical line at the x position of the text defind by fillText() or strokeText().

The text is aligned to the left when the textAlign property is set to left, when it's set to start and the document direction is ltr (left to right), or when it's set to end and the document direction is rtl (right to left).  The text is aligned to the right when the textAlign property is set to right, when it's set to end and the document direction is ltr, or when it's set to start and the document direction is rtl.  Unless otherwise specified, the textAlign property is defaulted tostart.

邮箱:
密码:

微信扫描二维码捐赠

当前实例由www.100sucai.com整理,
仅作学习参考。感谢大家对本站的支持
web前端交流群:Css Js 网站美工
Text Baseline