Canvas font() 方法

观看不同值的演示 font() 方法.

或者点击指定值查看结果

font('30px Arial');
font('30px Verdana');
font('30px Times New Roman');
font('30px Courier New');
font('30px serif');
font('30px sans-serif');
your browser does not support the canvas tag
your browser does not support the canvas tag
your browser does not support the canvas tag
your browser does not support the canvas tag
your browser does not support the canvas tag
your browser does not support the canvas tag
let c = document.getElementById('myCanvas');
let ctx = c.getContext('2d');
ctx.font='30px Arial';
ctx.fillText('Hello World',10,30);

在编辑器中更多地使用代码: 亲自尝试一下 ❯