我的筆:http://codepen.io/anon/pen/mBliE我怎樣才能讓這個長方形帆布一樣鋒利的CSS DIV
用相同的橙色背景和相同的黑色邊框,橙色CSS DIV看起來鋒利和清潔。
在畫布上繪製的橙色矩形看起來模糊/扭曲。
爲什麼會有差異?我沒有設定一個CSS樣式這是一個
初學者失敗我聽到;-)畫布高度/寬度
我怎樣才能讓我的畫布銳看起來像CSS?
<canvas id="mycanvas" height="200" width="400"></canvas>
<div></div>
div{
border:black 2px solid;
height:198px;
width:50px;
background:orange;
display:inline-block;
}
canvas {
background: red;
}
$(document).ready(function() {
var canvas = document.getElementById("mycanvas");
var context = canvas.getContext("2d");
context.save();
context.lineWidth = 1;
context.fillStyle = "orange";
context.fillRect(348, 1, 50, 198);
context.strokeStyle = "black";
context.strokeRect(348, 1, 50, 198);
context.fill();
context.restore();
});
我感動了一下週圍的矩形,他們看起來是一樣的我。 http://codepen.io/anon/pen/lDEqu – rfoo