kpded Posted July 25, 2018 Share Posted July 25, 2018 Hello! I'm trying to put a background behind the game div in Phaser 3. So that there is my game (960x640) in center of the page and the rest of the page covered with repetitive image In Phaser 2 I used the following code in my index.html and it worked <head> ... <style> .overlay { background: #acbbbe; background-image: url(assets/pageBack.png); background-repeat: repeat; position:fixed; width:100%; height:100%; top:0px; left:0px; } .divstyle{ position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); } </style> </head> <body> <div id="wrapper" class="overlay"> <div id="gameContainer" class="divstyle"> </div> </div> </body> ... Using this snippet together with the following index.js in Phaser 3 const gameConfig = { width: 640, height: 960, scene: SimpleScene, parent: 'gameContainer' }; new Phaser.Game(gameConfig); Brings the game div element behind the background div element What does cause that strange behavior? How can one fix that? Link to comment Share on other sites More sharing options...
Recommended Posts