I was working on a project and was confused on how to center a canvas on a button and Google didn’t help any. SO, I though maybe you all could.Here’s my code.
<button><canvas id="myCanvas" width="100" height="100"></canvas>.
</button>
<script>
const canvas = document.getElementById("myCanvas");
const ctx = canvas.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(20, 20, 150, 100);
</script>
So how would I center this on the button. Thank you!