HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
HTML Canvas Reference : Check the width of the text, before writing it on the canvas
The numbers in the table specify the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
measureText() | Yes | 9.0 | Yes | Yes | Yes |
The measureText() method returns an object that contains the width of the specified text, in pixels.
JavaScript syntax: | context.measureText(text).width; |
---|
Parameter | Description | Play it |
---|---|---|
text | The text to be measured | Play it » |
❮ HTML Canvas Reference