Just add centering style to your div.

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

It will work.


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.

    display: block;
    margin: auto;

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

Related Query