HTML canvas font Property Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The HTML canvas font Property is used to change the present font family of the Text content of the <canvas> element. The font Property has a Default Property i.e 10px sans-serif Syntax: context.font="italic small-caps bold 12px arial"; Property Values: font-family: It is used to set the font type of an HTML element. It holds several font names as a fallback font-style: It is used to specify the font style of an HTML element. It can be “normal, italic or oblique”. font-weight: It is used to set the boldness of the font. Its value can be “normal, bold, lighter, bolder”. font-variant: It is used to create the small-caps effect. It can be “normal or small-caps”. font-size: It is used to set the font size of an HTML element. The font-size can be set in different ways like in “pixels, percentage, em or we can set values like small, large” etc. caption: Use the font captioned controls (like buttons, drop-downs etc.) icon: Use the font used to label icons. menu: Use the font used in menus (drop-down menu and menu lists). message-box: Use the font used in dialog boxes. small-caption: Use the font used for labeling small controls status-bar: Use the fonts used in window status bar. Example: html <!DOCTYPE html> <html> <head> <title> HTML canvas font Property </title> </head> <body style="text-align:center"> <h1 style="color:green"> GeeksForGeeks </h1> <h2 style="color:green"> HTML canvas font Property </h2> <canvas id="sudo" width="300" height="150" style="border:2px solid"> </canvas> <script> var c = document.getElementById("sudo"); var ctx = c.getContext("2d"); ctx.font = "40px Arial"; ctx.fillText("GeeksForGeeks", 10, 50); </script> </body> </html> Output: Supported Browsers: The browsers supported by HTML canvas font Property are listed below: Google Chrome Internet Explorer 9.0 Firefox Apple Safari Opera Comment More info M manaschhabra2 Follow Improve Article Tags : Web Technologies HTML HTML-Property Explore HTML BasicsHTML Introduction5 min readHTML Editors5 min readHTML Basics7 min readStructure & ElementsHTML Elements5 min readHTML Attributes8 min readHTML Headings4 min readHTML Paragraphs5 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists5 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks3 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables10 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms5 min readHTML5 Semantics6 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List15+ min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like