标签:highlight .com nim context can mini element 默认 技术
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>(二)canvas边框问题</title> </head> <style> * {margin: 0;padding: 0;} body { background-color: black; } #c1 { background-color: #fff; } </style> <body> <canvas id="c1" width="400" height="400"></canvas> <script> oC = document.getElementById("c1"); var ctx = oC.getContext("2d"); ctx.lineWidth = 1;//设置边框大写 ctx.fillStyle = "yellow";//填充实体颜色 ctx.strokeStyle = "red";//填充边框颜色 ctx.strokeRect(50.5,50.5,100,100);//对边框的设置 ctx.fillRect(50.5,50.5,100,100);//对内容的设置 </script> </body> </html>
标签:highlight .com nim context can mini element 默认 技术
原文地址:https://www.cnblogs.com/bgwhite/p/9406787.html