[Solved]A game in the center of the browser?


  • Posts: 103
Is it possible to edit index.html
to start the game in the center of the page?

« Last Edit: September 24, 2019, 07:28:52 am by 1968 »


  • *
  • Posts: 2732
You could use any HTML editor (or just a simple text editor) to do this... but as far as I'm aware, there's no option to configure the HTML output page in Stencyl.


  • Posts: 103
Hi Merrak,
I meant "when starting the HTML5 game", the game opened in the center of the browser 8)


  • Posts: 327
Unfortunately, different browsers work differently.

I have been unable to come up with a code for all browsers. This is what I have been doing.

                                                                                             Change position and size of game to desired dimentions
<div id="Layer1" style="position:absolute; left:121px; top:38px; width:754px; height:331px; z-index:1">PASTE UR INDEX HERE</div>


  • Posts: 2262
Add this to your div style "margin: auto; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"


  • Posts: 327
Thanks JeffreyDriver, but that still isn't working on mobile.
Opera Touch is the only browser I found with it's own container.
Really need to figure out how to put the HTML5 in it's own container.  I've got something 10 hours trying to figure
out how to get the HTML5 to center and zoom on mobile.
Apple is terrible.


  • Posts: 103
Hi guys!
Your advice helped. 8)