<!DOCTYPE html> | |
<html> | |
<style> | |
html, body { margin: 0; padding: 0; } | |
</style> | |
<body> | |
<canvas id ="canvas" width="400" height="400" style="position:relative;"></canvas> | |
<script> | |
var canvas = document.getElementById('canvas'); | |
var context = canvas.getContext("2d"); | |
context.lineWidth = 20; | |
context.setLineDash([10, 30]); | |
context.lineDashOffset = 4; | |
context.beginPath(); | |
context.moveTo(0, 100); | |
context.lineTo(400, 100); | |
context.stroke(); | |
</script> | |
</body> | |
</html> |