Error when centralizing game on my page

I created a div id = mygame, and inside the var config:
scale: {
parent: ‘mygame’,
autoCenter: Phaser.Scale.CENTER_BOTH
},
but does not center the game in the center of the page

I have a .css file with:

body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
margin: 0;
}

And in my configuration:

scale: {
mode: Phaser.Scale.FIT,
height: 270,
width: 480,
autoCenter: Phaser.Scale.CENTER_BOTH,
parent: ‘gameContainer’
},

1 Like

Hi, add to phaser config:
autoCenter: true,

2 Likes

both ways can solve my problem, but I created a new page and imported the game through the iframe tag. thanks for listening.