Why cant I change the position of the canvas tag in my html file? [duplicate]

I want to center the canvas function init() { console.log("Hello world!"); draw(); } function draw() { var myCanv = document.getElementById("can"); const rctngl = myCanv.getContext("2d"); rctngl.fillStyle = "yellow"; rctngl.strokeRect(19, 19, 42, 42); rctngl.fillRect(20, 20, 40, 40); } Basic Partical System Change Spawn Color Frame Count: 0 Rectangle Count: 0 I am have no idea where I am making a mistake. or if canvas can even be moved. Any help would be appreciated after trying these in the canvas tag: position: relative; position: center; margin-left: auto; margin-left: 100px; Nothing has changed and it stays on the left of the page and will not move at all.

Why cant I change the position of the canvas tag in my html file? [duplicate]

I want to center the canvas




    




Basic Partical System





Frame Count: 0

Rectangle Count: 0

I am have no idea where I am making a mistake. or if canvas can even be moved. Any help would be appreciated

after trying these in the canvas tag:
position: relative;
position: center;
margin-left: auto;
margin-left: 100px;

Nothing has changed and it stays on the left of the page and will not move at all.