Set the stroke color and width on canvas examples
Set the stroke color and width on canvas examples
<!DOCTYPE html>
<html>
<head>
<title>Set the stroke color and width on canvas examples</title>
<style type="text/css">
canvas {
border: 2px solid yellow;
}
</style>
<script type="text/javascript">
window.onload = function() {
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
context.lineWidth = 5;
context.strokeStyle = "orange";
context.moveTo(50, 150);
context.lineTo(250, 50);
context.stroke();
};
</script>
</head>
<body>
<canvas id="myCanvas" width="300" height="200"></canvas>
</body>
</html>
Output