javascript - 为什么结果会向下移了10px
本文介绍了javascript - 为什么结果会向下移了10px的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
<!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";
这篇关于javascript - 为什么结果会向下移了10px的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文