score:1

Just add centering style to your div.

<div  id='canvas' style="text-align:center;"></div>

It will work.

score:11

You can add couple of css lines to the SVG element. You can inline it or have it in a separate style sheet. Just make sure it loads.

svg{
    display: block;
    margin: auto;
}

This will align the SVG to the center of the div.


Related Query