为了账号安全,请及时绑定邮箱和手机立即绑定

为什么我的文字不能居中对齐,有点靠上

https://img1.sycdn.imooc.com//5d510b9c000109d109610897.jpg

window.onload = function() {var canvas = document.getElementById('canvas');canvas.width = 800;canvas.height = 800;var context = canvas.getContext('2d');context.fillStyle = "#058";context.font = "bold 120px sans-serif";context.textAlign = 'center';context.textBaseline = 'middle';context.fillText('CANVAS', canvas.width/2, canvas.height/2);context.strokeStyle = '#888';context.moveTo(0, canvas.height/2);context.lineTo(canvas.width, canvas.height/2);context.moveTo(canvas.width/2, 0);context.lineTo(canvas.width/2, canvas.height);context.stroke();}


正在回答

1 回答

在谷歌浏览器中不行,换了WIn10自带浏览器可以居中

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

为什么我的文字不能居中对齐,有点靠上

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号