Jump to content

Put game in div with width and height in percentage


Recommended Posts

I want to put my phaser game into div like on picture below. Now I use

var game = new Phaser.Game('90', '100', Phaser.CANVAS, 'game-container')

for game, an this layout

<div id="palyers-container" style="float: right;">dasdada sdasda</div>
<div id="game-container" style=""></div>

So now I have a vertical scroll (not good) and players-container works in a bad way while resizing browser window. How to fix it?


Link to comment
Share on other sites

It really depends on what you're trying to achieve and how what you have now isn't letting you achieve it. You should probably look into using flexbox (depending on what browsers you're targetting) and, possibly, setting "overlay: none" as a CSS property on whatever div it is that has a vertical scroll in it (I'm not sure which one that is).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...