YouTip LogoYouTip

Canvas Font

## Definition and Usage The font property is a shorthand property for setting font style, font size, font weight, etc. The font property can set the following values: - font-style - font-variant - font-weight - font-size/line-height - font-family **Note:** The value of the font property must include at least font-size and font-family. ## Browser Support
PropertyChromeEdgeFirefoxSafariOpera
fontYesYesYesYesYes
## Example Set canvas font to 30px Arial: Your browser does not support the HTML5 canvas tag. var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.font="30px Arial"; ctx.fillText("Hello World!",10,50); ## More Examples (#) (#) (#) ## Technical Details | | | | --- | --- | | Supported Values | font-style, font-variant, font-weight, font-size/line-height, font-family | | Default Value | Depends on browser | | Applies to | Canvas | | Animation Support | No | | Version | HTML5 | | JavaScript Syntax | *context*.font="*font-style font-variant font-weight font-size/line-height font-family*"; | ## More Tutorials - (#) - (#) - (#) - (#) - (#) - (#) - (#) - [HTML canvas createLinearGradie
← Canvas TextalignCanvas Settransform β†’