<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>practice</title>
<style>
body{background:black}#cvs{background:white}
</style>
<script>
window.onload=function(){
var oCvs=document.getElementById("cvs");var oGc=oCvs.getContext("2d"); oGc.font="60px impact";oGc.textBaseline="top";oGc.fillText("妙味课堂",0,0);
}
</script>
</head>
<body>
<canvas id="cvs" width="400px" height="400px"></canvas>
</body>
</html>
解决方案
oGc.textBaseline="hanging";