How do I move Phaser.Game to the center of a browser?

So, I tried to center my game in the browser (well basically you want to center canvas element). And I was able to center my game just by using css (in my case I used SCSS, but it really doesnt matter).
My config file looks like this
obrázok
My html looks like this:
obrázok
My DIV with the ID of “game” is the parent for the canvas.
Then the centering part using SCSS:
obrázok
And finally here is the result:


I’m not sure if you were trying to achieve this, but it worked for me. My game (or canvas) is in the center of the browser. But if you are going to place more elements in HTML (like some header or footer) than you need to optimize whole CSS thing. Also small tip if your game was working and than after some changes in the code the whole page is white than hit F12 to open browser console, usually there will be some errors. Usually if the error is caused by variable/function there will also be the line on which the error is. If you have more questions, I might be able to help you. Hopefully I solved your problem. Good luck :slight_smile: